Qt Jambi Home

com.trolltech.qt.gui
Class QCalendarWidget

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QCalendarWidget
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QCalendarWidget
extends QWidget

The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date.

The widget is initialized with the current month and year, but QCalendarWidget provides several public slots to change the year and month that is shown. The currently displayed month and year can be retrieved using the currentPageMonth() and currentPageYear() functions, respectively.

By default, today's date is selected, and the user can select a date using both mouse and keyboard. The currently selected date can be retrieved using the selectedDate function. It is possible to constrain the user selection to a given date range by setting the minimumDate and maximumDate properties. Alternatively, both properties can be set in one go using the setDateRange convenience slot. Set the selectionMode property to NoSelection to prohibit the user from selecting at all. Note that a date also can be selected programmatically using the setSelectedDate slot.

A newly created calendar widget uses abbreviated day names, and both Saturdays and Sundays are marked in red. The calendar grid is not visible. The week numbers are displayed, and the first column day is Sunday.

The notation of the days can be altered to a single letter abbreviations ("M" for "Monday") by setting the horizontalHeaderFormat property to QCalendarWidget::SingleLetterDayNames. Setting the same property to QCalendarWidget::LongDayNames makes the header display the complete day names. The week numbers can be removed by setting the verticalHeaderFormat property to QCalendarWidget::NoVerticalHeader. The calendar grid can be turned on by setting the gridVisible property to true using the setGridVisible function:

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);

Finally, the day in the first column can be altered using the setFirstDayOfWeek function.

The QCalendarWidget class also provides three signals, selectionChanged, activated and currentPageChanged making it possible to respond to user interaction.

The rendering of the headers, weekdays or single days can be largely customized by setting QTextCharFormat's for some special weekday, a special date or for the rendering of the headers.

Only a subset of the properties in QTextCharFormat are used by the calendar widget. Currently, the foreground, background and font properties are used to determine the rendering of individual cells in the widget.

See Also:
QDate, QDateEdit, QTextCharFormat

Nested Class Summary
static class QCalendarWidget.HorizontalHeaderFormat
          This enum type defines the various formats the horizontal header can display.
static class QCalendarWidget.SelectionMode
          This enum describes the types of selection offered to the user for selecting dates in the calendar.
static class QCalendarWidget.VerticalHeaderFormat
          This enum type defines the various formats the vertical header can display.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal1<QDate> activated
          This signal is emitted whenever the user presses the Return or Enter key or double-clicks a date in the calendar widget.
 QSignalEmitter.Signal1<QDate> clicked
          This signal is emitted when a mouse button is clicked.
 QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> currentPageChanged
          This signal is emitted when the currently shown month is changed.
 QSignalEmitter.Signal0 selectionChanged
          This signal is emitted when the currently selected date is changed.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QCalendarWidget()
          Equivalent to QCalendarWidget(0).
QCalendarWidget(QWidget parent)
          Constructs a calendar widget with the given parent.
 
Method Summary
 int dateEditAcceptDelay()
          Returns the time an inactive date edit is shown before its contents are accepted.
 java.util.SortedMap<QDate,QTextCharFormat> dateTextFormat()
          Returns a QMap from QDate to QTextCharFormat showing all dates that use a special format that alters their rendering.
 QTextCharFormat dateTextFormat(QDate date)
          Returns a QTextCharFormat for date.
 boolean event(QEvent event)
          This function is reimplemented for internal reasons.
 Qt.DayOfWeek firstDayOfWeek()
          Returns a value identifying the day displayed in the first column..
static QCalendarWidget fromNativePointer(QNativePointer nativePointer)
          This function returns the QCalendarWidget instance pointed to by nativePointer
 QTextCharFormat headerTextFormat()
          Returns the text char format for rendering the header.
 QCalendarWidget.HorizontalHeaderFormat horizontalHeaderFormat()
          Returns the format of the horizontal header..
 boolean isDateEditEnabled()
          Returns whether the date edit popup is enabled.
 boolean isGridVisible()
          Returns whether the table grid is displayed..
 boolean isNavigationBarVisible()
          Returns whether the navigation bar is shown or not.
protected  void keyPressEvent(QKeyEvent event)
          This function is reimplemented for internal reasons.
 QDate maximumDate()
          Returns the maximum date of the currently specified date range..
 QDate minimumDate()
          Returns the minimum date of the currently specified date range..
 QSize minimumSizeHint()
          This function is reimplemented for internal reasons.
 int monthShown()
          Returns the currently displayed month.
protected  void mousePressEvent(QMouseEvent event)
          This function is reimplemented for internal reasons.
protected  void paintCell(QPainter painter, QRect rect, QDate date)
          Paints the cell specified by the given date, using the given painter and rect.
protected  void resizeEvent(QResizeEvent event)
          This function is reimplemented for internal reasons.
 QDate selectedDate()
          Returns the currently selected date..
 QCalendarWidget.SelectionMode selectionMode()
          Returns the type of selection the user can make in the calendar.
 void setCurrentPage(int year, int month)
          Displays the given month of the given year without changing the selected date.
 void setDateEditAcceptDelay(int delay)
          Sets the time an inactive date edit is shown before its contents are accepted to delay.
 void setDateEditEnabled(boolean enable)
          Sets whether the date edit popup is enabled to enable.
 void setDateRange(QDate min, QDate max)
          Defines a date range by setting the minimumDate and maximumDate properties.
 void setDateTextFormat(QDate date, QTextCharFormat color)
          
 void setFirstDayOfWeek(Qt.DayOfWeek dayOfWeek)
          Sets a value identifying the day displayed in the first column.
 void setGridVisible(boolean show)
          Sets whether the table grid is displayed.
 void setHeaderTextFormat(QTextCharFormat format)
          Sets the text char format for rendering the header to format.
 void setHorizontalHeaderFormat(QCalendarWidget.HorizontalHeaderFormat format)
          Sets the format of the horizontal header.
 void setMaximumDate(QDate date)
          Sets the maximum date of the currently specified date range.
 void setMinimumDate(QDate date)
          Sets the minimum date of the currently specified date range.
 void setNavigationBarVisible(boolean visible)
          Sets whether the navigation bar is shown or not to visible.
 void setSelectedDate(QDate date)
          Sets the currently selected date.
 void setSelectionMode(QCalendarWidget.SelectionMode mode)
          Sets the type of selection the user can make in the calendar to mode.
 void setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat format)
          Sets the format of the vertical header.
 void setWeekdayTextFormat(Qt.DayOfWeek dayOfWeek, QTextCharFormat format)
          Sets the text char format for rendering of day in the week dayOfWeek to format.
 void showNextMonth()
          Shows the next month relative to the currently displayed month.
 void showNextYear()
          Shows the currently displayed month in the next year relative to the currently displayed year.
 void showPreviousMonth()
          Shows the previous month relative to the currently displayed month.
 void showPreviousYear()
          Shows the currently displayed month in the previous year relative to the currently displayed year.
 void showSelectedDate()
          Shows the month of the selected date.
 void showToday()
          Shows the month of the today's date.
 QSize sizeHint()
          This function is reimplemented for internal reasons.
 QCalendarWidget.VerticalHeaderFormat verticalHeaderFormat()
          Returns the format of the vertical header..
 QTextCharFormat weekdayTextFormat(Qt.DayOfWeek dayOfWeek)
          Returns the text char format for rendering of day in the week dayOfWeek.
 int yearShown()
          Returns the year of the currently displayed month.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mouseReleaseEvent, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

activated

public final QSignalEmitter.Signal1<QDate> activated

This signal is emitted whenever the user presses the Return or Enter key or double-clicks a date in the calendar widget.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QDate date)
void mySlot()


clicked

public final QSignalEmitter.Signal1<QDate> clicked

This signal is emitted when a mouse button is clicked. The date the mouse was clicked on is specified by date. The signal is only emitted when clicked on a valid date.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QDate date)
void mySlot()


currentPageChanged

public final QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> currentPageChanged

This signal is emitted when the currently shown month is changed. The new year and month are passed as parameters.

Compatible Slot Signatures:
void mySlot(int year, int month)
void mySlot(int year)
void mySlot()
See Also:
setCurrentPage


selectionChanged

public final QSignalEmitter.Signal0 selectionChanged

This signal is emitted when the currently selected date is changed.

The currently selected date can be changed by the user using the mouse or keyboard, or by the programmer using setSelectedDate.

Compatible Slot Signature:
void mySlot()
See Also:
selectedDate

Constructor Detail

QCalendarWidget

public QCalendarWidget()

Equivalent to QCalendarWidget(0).


QCalendarWidget

public QCalendarWidget(QWidget parent)

Constructs a calendar widget with the given parent.

The widget is initialized with the current month and year, and the currently selected date is today.

See Also:
setCurrentPage
Method Detail

dateEditAcceptDelay

public final int dateEditAcceptDelay()

Returns the time an inactive date edit is shown before its contents are accepted.

If the calendar widget's date edit is enabled, this property specifies the amount of time (in millseconds) that the date edit remains open after the most recent user input. Once this time has elapsed, the date specified in the date edit is accepted and the popup is closed.

By default, the delay is defined to be 1500 milliseconds (1.5 seconds).

See Also:
setDateEditAcceptDelay

dateTextFormat

public final QTextCharFormat dateTextFormat(QDate date)

Returns a QTextCharFormat for date. The char format can be be empty if the date is not renderd specially.


dateTextFormat

public final java.util.SortedMap<QDate,QTextCharFormat> dateTextFormat()

Returns a QMap from QDate to QTextCharFormat showing all dates that use a special format that alters their rendering.

See Also:
setDateTextFormat

firstDayOfWeek

public final Qt.DayOfWeek firstDayOfWeek()

Returns a value identifying the day displayed in the first column..

By default, the day displayed in the first column is Sunday

See Also:
setFirstDayOfWeek

headerTextFormat

public final QTextCharFormat headerTextFormat()

Returns the text char format for rendering the header.

See Also:
setHeaderTextFormat

horizontalHeaderFormat

public final QCalendarWidget.HorizontalHeaderFormat horizontalHeaderFormat()

Returns the format of the horizontal header..

The default value is QCalendarWidget::ShortDayNames.

See Also:
setHorizontalHeaderFormat

isDateEditEnabled

public final boolean isDateEditEnabled()

Returns whether the date edit popup is enabled.

If this property is enabled, pressing a non-modifier key will cause a date edit to popup if the calendar widget has focus, allowing the user to specify a date in the form specified by the current locale.

By default, this property is enabled.

The date edit is simpler in appearance than QDateEdit, but allows the user to navigate between fields using the left and right cursor keys, increment and decrement individual fields using the up and down cursor keys, and enter values directly using the number keys.

See Also:
QCalendarWidget::dateEditAcceptDelay

isGridVisible

public final boolean isGridVisible()

Returns whether the table grid is displayed..

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);

The default value is false.


isNavigationBarVisible

public final boolean isNavigationBarVisible()

Returns whether the navigation bar is shown or not.

When this property is true (the default), the next month, previous month, month selection, year selection controls are shown on top.

When the property is set to false, these controls are hidden.


maximumDate

public final QDate maximumDate()

Returns the maximum date of the currently specified date range..

The user will not be able to select a date which is after the currently set maximum date.

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);
    calendar->setMaximumDate(QDate(2006, 7, 3));

By default, the maximum date is the last day the QDate class can handle.

When setting a maximum date, the minimumDate and selectedDate properties are adjusted if the selection range becomes invalid. If the provided date is not a valid QDate object, the setMaximumDate function does nothing.

See Also:
setMaximumDate, setDateRange

minimumDate

public final QDate minimumDate()

Returns the minimum date of the currently specified date range..

The user will not be able to select a date that is before the currently set minimum date.

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);
    calendar->setMinimumDate(QDate(2006, 6, 19));

By default, the minimum date is the earliest date that the QDate class can handle.

When setting a minimum date, the maximumDate and selectedDate properties are adjusted if the selection range becomes invalid. If the provided date is not a valid QDate object, the setMinimumDate function does nothing.

See Also:
setMinimumDate, setDateRange

monthShown

public final int monthShown()

Returns the currently displayed month. Months are numbered from 1 to 12.

See Also:
yearShown, setCurrentPage

selectedDate

public final QDate selectedDate()

Returns the currently selected date..

The selected date must be within the date range specified by the minimumDate and maximumDate properties. By default, the selected date is the current date.

See Also:
setSelectedDate, setDateRange

selectionMode

public final QCalendarWidget.SelectionMode selectionMode()

Returns the type of selection the user can make in the calendar.

When this property is set to SingleSelection, the user can select a date within the minimum and maximum allowed dates, using either the mouse or the keyboard.

When the property is set to NoSelection, the user will be unable to select dates, but they can still be selected programmatically. Note that the date that is selected when the property is set to NoSelection will still be the selected date of the calendar.

The default value is SingleSelection.

See Also:
setSelectionMode

setCurrentPage

public final void setCurrentPage(int year,
                                 int month)

Displays the given month of the given year without changing the selected date. Use the setSelectedDate function to alter the selected date.

The currently displayed month and year can be retrieved using the currentPageMonth() and currentPageYear() functions respectively.

See Also:
yearShown, monthShown, showPreviousMonth, showNextMonth, showPreviousYear, showNextYear

setDateEditAcceptDelay

public final void setDateEditAcceptDelay(int delay)

Sets the time an inactive date edit is shown before its contents are accepted to delay.

If the calendar widget's date edit is enabled, this property specifies the amount of time (in millseconds) that the date edit remains open after the most recent user input. Once this time has elapsed, the date specified in the date edit is accepted and the popup is closed.

By default, the delay is defined to be 1500 milliseconds (1.5 seconds).

See Also:
dateEditAcceptDelay

setDateEditEnabled

public final void setDateEditEnabled(boolean enable)

Sets whether the date edit popup is enabled to enable.

If this property is enabled, pressing a non-modifier key will cause a date edit to popup if the calendar widget has focus, allowing the user to specify a date in the form specified by the current locale.

By default, this property is enabled.

The date edit is simpler in appearance than QDateEdit, but allows the user to navigate between fields using the left and right cursor keys, increment and decrement individual fields using the up and down cursor keys, and enter values directly using the number keys.

See Also:
isDateEditEnabled, QCalendarWidget::dateEditAcceptDelay

setDateRange

public final void setDateRange(QDate min,
                               QDate max)

Defines a date range by setting the minimumDate and maximumDate properties.

The date range restricts the user selection, i.e. the user can only select dates within the specified date range. Note that

    QCalendarWidget *calendar;

    calendar->setDateRange(min, max);

is analogous to

    QCalendarWidget *calendar;

    calendar->setMinimumDate(min);
    calendar->setMaximumDate(max);

If either the min or max parameters are not valid QDate objects, this function does nothing.

See Also:
setMinimumDate, setMaximumDate

setDateTextFormat

public final void setDateTextFormat(QDate date,
                                    QTextCharFormat color)

See Also:
dateTextFormat

setFirstDayOfWeek

public final void setFirstDayOfWeek(Qt.DayOfWeek dayOfWeek)

Sets a value identifying the day displayed in the first column. to dayOfWeek.

By default, the day displayed in the first column is Sunday

See Also:
firstDayOfWeek

setGridVisible

public final void setGridVisible(boolean show)

Sets whether the table grid is displayed. to show.

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);

The default value is false.

See Also:
isGridVisible

setHeaderTextFormat

public final void setHeaderTextFormat(QTextCharFormat format)

Sets the text char format for rendering the header to format. If you also set a weekday text format, this format's foreground and background color will take precedence over the header's format. The other formatting information will still be decided by the header's format.

See Also:
headerTextFormat

setHorizontalHeaderFormat

public final void setHorizontalHeaderFormat(QCalendarWidget.HorizontalHeaderFormat format)

Sets the format of the horizontal header. to format.

The default value is QCalendarWidget::ShortDayNames.

See Also:
horizontalHeaderFormat

setMaximumDate

public final void setMaximumDate(QDate date)

Sets the maximum date of the currently specified date range. to date.

The user will not be able to select a date which is after the currently set maximum date.

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);
    calendar->setMaximumDate(QDate(2006, 7, 3));

By default, the maximum date is the last day the QDate class can handle.

When setting a maximum date, the minimumDate and selectedDate properties are adjusted if the selection range becomes invalid. If the provided date is not a valid QDate object, the setMaximumDate function does nothing.

See Also:
maximumDate, setDateRange

setMinimumDate

public final void setMinimumDate(QDate date)

Sets the minimum date of the currently specified date range. to date.

The user will not be able to select a date that is before the currently set minimum date.

    QCalendarWidget *calendar;
    calendar->setGridVisible(true);
    calendar->setMinimumDate(QDate(2006, 6, 19));

By default, the minimum date is the earliest date that the QDate class can handle.

When setting a minimum date, the maximumDate and selectedDate properties are adjusted if the selection range becomes invalid. If the provided date is not a valid QDate object, the setMinimumDate function does nothing.

See Also:
minimumDate, setDateRange

setNavigationBarVisible

public final void setNavigationBarVisible(boolean visible)

Sets whether the navigation bar is shown or not to visible.

When this property is true (the default), the next month, previous month, month selection, year selection controls are shown on top.

When the property is set to false, these controls are hidden.

See Also:
isNavigationBarVisible

setSelectedDate

public final void setSelectedDate(QDate date)

Sets the currently selected date. to date.

The selected date must be within the date range specified by the minimumDate and maximumDate properties. By default, the selected date is the current date.

See Also:
selectedDate, setDateRange

setSelectionMode

public final void setSelectionMode(QCalendarWidget.SelectionMode mode)

Sets the type of selection the user can make in the calendar to mode.

When this property is set to SingleSelection, the user can select a date within the minimum and maximum allowed dates, using either the mouse or the keyboard.

When the property is set to NoSelection, the user will be unable to select dates, but they can still be selected programmatically. Note that the date that is selected when the property is set to NoSelection will still be the selected date of the calendar.

The default value is SingleSelection.

See Also:
selectionMode

setVerticalHeaderFormat

public final void setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat format)

Sets the format of the vertical header. to format.

The default value is QCalendarWidget::ISOWeekNumber.

See Also:
verticalHeaderFormat

setWeekdayTextFormat

public final void setWeekdayTextFormat(Qt.DayOfWeek dayOfWeek,
                                       QTextCharFormat format)

Sets the text char format for rendering of day in the week dayOfWeek to format. The format will take precedence over the header format in case of foreground and background color. Other text formatting information is taken from the headers format.

See Also:
weekdayTextFormat, setHeaderTextFormat

showNextMonth

public final void showNextMonth()

Shows the next month relative to the currently displayed month. Note that the selected date is not changed.

See Also:
showPreviousMonth, setCurrentPage, setSelectedDate

showNextYear

public final void showNextYear()

Shows the currently displayed month in the next year relative to the currently displayed year. Note that the selected date is not changed.

See Also:
showPreviousYear, setCurrentPage, setSelectedDate

showPreviousMonth

public final void showPreviousMonth()

Shows the previous month relative to the currently displayed month. Note that the selected date is not changed.

See Also:
showNextMonth, setCurrentPage, setSelectedDate

showPreviousYear

public final void showPreviousYear()

Shows the currently displayed month in the previous year relative to the currently displayed year. Note that the selected date is not changed.

See Also:
showNextYear, setCurrentPage, setSelectedDate

showSelectedDate

public final void showSelectedDate()

Shows the month of the selected date.

See Also:
selectedDate, setCurrentPage

showToday

public final void showToday()

Shows the month of the today's date.

See Also:
selectedDate, setCurrentPage

verticalHeaderFormat

public final QCalendarWidget.VerticalHeaderFormat verticalHeaderFormat()

Returns the format of the vertical header..

The default value is QCalendarWidget::ISOWeekNumber.

See Also:
setVerticalHeaderFormat

weekdayTextFormat

public final QTextCharFormat weekdayTextFormat(Qt.DayOfWeek dayOfWeek)

Returns the text char format for rendering of day in the week dayOfWeek.

See Also:
setWeekdayTextFormat, headerTextFormat

yearShown

public final int yearShown()

Returns the year of the currently displayed month. Months are numbered from 1 to 12.

See Also:
monthShown, setCurrentPage

event

public boolean event(QEvent event)

This function is reimplemented for internal reasons.

Overrides:
event in class QWidget
See Also:
closeEvent, focusInEvent, focusOutEvent, enterEvent, keyPressEvent, keyReleaseEvent, leaveEvent, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveEvent, paintEvent, resizeEvent, QObject::event, QObject::timerEvent

keyPressEvent

protected void keyPressEvent(QKeyEvent event)

This function is reimplemented for internal reasons.

Overrides:
keyPressEvent in class QWidget
See Also:
keyReleaseEvent, QKeyEvent::ignore, setFocusPolicy, focusInEvent, focusOutEvent, event, QKeyEvent, Tetrix Example

minimumSizeHint

public QSize minimumSizeHint()

This function is reimplemented for internal reasons.

Overrides:
minimumSizeHint in class QWidget
See Also:
QSize::isValid, resize, setMinimumSize, sizePolicy

mousePressEvent

protected void mousePressEvent(QMouseEvent event)

This function is reimplemented for internal reasons.

Overrides:
mousePressEvent in class QWidget
See Also:
mouseReleaseEvent, mouseDoubleClickEvent, mouseMoveEvent, event, QMouseEvent, Example

paintCell

protected void paintCell(QPainter painter,
                         QRect rect,
                         QDate date)

Paints the cell specified by the given date, using the given painter and rect.


resizeEvent

protected void resizeEvent(QResizeEvent event)

This function is reimplemented for internal reasons.

Overrides:
resizeEvent in class QWidget
See Also:
moveEvent, event, resize, QResizeEvent, paintEvent, Example

sizeHint

public QSize sizeHint()

This function is reimplemented for internal reasons.

Overrides:
sizeHint in class QWidget
See Also:
QSize::isValid, minimumSizeHint, sizePolicy, setMinimumSize, updateGeometry

fromNativePointer

public static QCalendarWidget fromNativePointer(QNativePointer nativePointer)
This function returns the QCalendarWidget instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home