Qt 4.8
Public Functions | Public Variables | List of all members
QCalendarWidgetPrivate Class Reference
Inheritance diagram for QCalendarWidgetPrivate:
QWidgetPrivate QObjectPrivate QObjectData

Public Functions

void _q_editingFinished ()
 
void _q_monthChanged (QAction *)
 
void _q_nextMonthClicked ()
 
void _q_prevMonthClicked ()
 
void _q_slotChangeDate (const QDate &date)
 
void _q_slotChangeDate (const QDate &date, bool changeMonth)
 
void _q_slotShowDate (const QDate &date)
 
void _q_yearClicked ()
 
void _q_yearEditingFinished ()
 
void createNavigationBar (QWidget *widget)
 
QDate getCurrentDate ()
 
void paintCell (QPainter *painter, const QRect &rect, const QDate &date) const
 
 QCalendarWidgetPrivate ()
 
void setNavigatorEnabled (bool enable)
 
void showMonth (int year, int month)
 
void update ()
 
void updateButtonIcons ()
 
void updateCurrentPage (const QDate &newDate)
 
void updateMonthMenu ()
 
void updateMonthMenuNames ()
 
void updateNavigationBar ()
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QSize cachedSizeHint
 
bool m_dateEditEnabled
 
QCalendarDelegatem_delegate
 
QCalendarModelm_model
 
QCalendarTextNavigatorm_navigator
 
QItemSelectionModelm_selection
 
QCalendarViewm_view
 
QCalToolButtonmonthButton
 
QMenumonthMenu
 
QMap< int, QAction * > monthToAction
 
QWidgetnavBarBackground
 
bool navBarVisible
 
QToolButtonnextMonth
 
Qt::FocusPolicy oldFocusPolicy
 
QToolButtonprevMonth
 
QSpacerItemspaceHolder
 
QCalToolButtonyearButton
 
QSpinBoxyearEdit
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 1576 of file qcalendarwidget.cpp.

Constructors and Destructors

◆ QCalendarWidgetPrivate()

QCalendarWidgetPrivate::QCalendarWidgetPrivate ( )

Definition at line 1650 of file qcalendarwidget.cpp.

1651  : QWidgetPrivate()
1652 {
1653  m_model = 0;
1654  m_view = 0;
1655  m_delegate = 0;
1656  m_selection = 0;
1657  m_navigator = 0;
1658  m_dateEditEnabled = false;
1659  navBarVisible = true;
1661 }
QCalendarDelegate * m_delegate
Qt::FocusPolicy oldFocusPolicy
QItemSelectionModel * m_selection
QCalendarTextNavigator * m_navigator
QWidgetPrivate(int version=QObjectPrivateVersion)
Definition: qwidget.cpp:288

Functions

◆ _q_editingFinished()

void QCalendarWidgetPrivate::_q_editingFinished ( )

Definition at line 1952 of file qcalendarwidget.cpp.

Referenced by setNavigatorEnabled().

1953 {
1955  emit q->activated(m_model->m_date);
1956 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76

◆ _q_monthChanged()

void QCalendarWidgetPrivate::_q_monthChanged ( QAction act)

Definition at line 1826 of file qcalendarwidget.cpp.

1827 {
1828  monthButton->setText(act->text());
1829  QDate currentDate = getCurrentDate();
1830  QDate newDate = currentDate.addMonths(act->data().toInt()-currentDate.month());
1831  updateCurrentPage(newDate);
1832 }
void setText(const QString &text)
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
Definition: qdatetime.cpp:382
The QDate class provides date functions.
Definition: qdatetime.h:55
QDate addMonths(int months) const
Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nm...
Definition: qdatetime.cpp:1016
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
QVariant data() const
Returns the user data as set in QAction::setData.
Definition: qaction.cpp:1280
QCalToolButton * monthButton
void updateCurrentPage(const QDate &newDate)

◆ _q_nextMonthClicked()

void QCalendarWidgetPrivate::_q_nextMonthClicked ( )

Definition at line 1846 of file qcalendarwidget.cpp.

1847 {
1848  QDate currentDate = getCurrentDate().addMonths(1);
1849  updateCurrentPage(currentDate);
1850 }
The QDate class provides date functions.
Definition: qdatetime.h:55
QDate addMonths(int months) const
Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nm...
Definition: qdatetime.cpp:1016
void updateCurrentPage(const QDate &newDate)

◆ _q_prevMonthClicked()

void QCalendarWidgetPrivate::_q_prevMonthClicked ( )

Definition at line 1840 of file qcalendarwidget.cpp.

1841 {
1842  QDate currentDate = getCurrentDate().addMonths(-1);
1843  updateCurrentPage(currentDate);
1844 }
The QDate class provides date functions.
Definition: qdatetime.h:55
QDate addMonths(int months) const
Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nm...
Definition: qdatetime.cpp:1016
void updateCurrentPage(const QDate &newDate)

◆ _q_slotChangeDate() [1/2]

void QCalendarWidgetPrivate::_q_slotChangeDate ( const QDate date)

Definition at line 1932 of file qcalendarwidget.cpp.

Referenced by setNavigatorEnabled().

1933 {
1934  _q_slotChangeDate(date, true);
1935 }
void _q_slotChangeDate(const QDate &date)

◆ _q_slotChangeDate() [2/2]

void QCalendarWidgetPrivate::_q_slotChangeDate ( const QDate date,
bool  changeMonth 
)

Definition at line 1937 of file qcalendarwidget.cpp.

1938 {
1939  QDate oldDate = m_model->m_date;
1940  m_model->setDate(date);
1941  QDate newDate = m_model->m_date;
1942  if (changeMonth)
1943  showMonth(newDate.year(), newDate.month());
1944  if (oldDate != newDate) {
1945  update();
1947  m_navigator->setDate(newDate);
1948  emit q->selectionChanged();
1949  }
1950 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
Definition: qdatetime.cpp:382
The QDate class provides date functions.
Definition: qdatetime.h:55
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
QCalendarTextNavigator * m_navigator
void setDate(const QDate &d)
void showMonth(int year, int month)
int year() const
Returns the year of this date.
Definition: qdatetime.cpp:353
void setDate(const QDate &date)

◆ _q_slotShowDate()

void QCalendarWidgetPrivate::_q_slotShowDate ( const QDate date)

Definition at line 1927 of file qcalendarwidget.cpp.

1928 {
1929  updateCurrentPage(date);
1930 }
void updateCurrentPage(const QDate &newDate)

◆ _q_yearClicked()

void QCalendarWidgetPrivate::_q_yearClicked ( )

Definition at line 1866 of file qcalendarwidget.cpp.

1867 {
1869  //show the spinbox on top of the button
1873  yearButton->hide();
1874  oldFocusPolicy = q->focusPolicy();
1875  q->setFocusPolicy(Qt::NoFocus);
1876  yearEdit->show();
1877  qApp->installEventFilter(q);
1878  yearEdit->raise();
1879  yearEdit->selectAll();
1881 }
int y() const
QCalToolButton * yearButton
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
#define Q_Q(Class)
Definition: qglobal.h:2483
int width() const
Returns the width.
Definition: qsize.h:126
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
#define qApp
int width() const
void selectAll()
Selects all the text in the spinbox except the prefix and suffix.
Qt::FocusPolicy oldFocusPolicy
void show()
Shows the widget and its child widgets.
void hide()
Hides the widget.
Definition: qwidget.h:501
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
QSize sizeHint() const
Reimplemented Function
int x() const
void changeSize(int w, int h, QSizePolicy::Policy hData=QSizePolicy::Minimum, QSizePolicy::Policy vData=QSizePolicy::Minimum)
Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hPolic...

◆ _q_yearEditingFinished()

void QCalendarWidgetPrivate::_q_yearEditingFinished ( )

Definition at line 1852 of file qcalendarwidget.cpp.

1853 {
1856  yearEdit->hide();
1857  q->setFocusPolicy(oldFocusPolicy);
1858  qApp->removeEventFilter(q);
1859  spaceHolder->changeSize(0, 0);
1860  yearButton->show();
1861  QDate currentDate = getCurrentDate();
1862  currentDate = currentDate.addYears(yearEdit->text().toInt() - currentDate.year());
1863  updateCurrentPage(currentDate);
1864 }
void setText(const QString &text)
QCalToolButton * yearButton
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
The QDate class provides date functions.
Definition: qdatetime.h:55
QDate addYears(int years) const
Returns a QDate object containing a date nyears later than the date of this object (or earlier if nye...
Definition: qdatetime.cpp:1081
#define Q_Q(Class)
Definition: qglobal.h:2483
#define qApp
Qt::FocusPolicy oldFocusPolicy
void show()
Shows the widget and its child widgets.
void hide()
Hides the widget.
Definition: qwidget.h:501
QString text() const
int year() const
Returns the year of this date.
Definition: qdatetime.cpp:353
void changeSize(int w, int h, QSizePolicy::Policy hData=QSizePolicy::Minimum, QSizePolicy::Policy vData=QSizePolicy::Minimum)
Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hPolic...
void updateCurrentPage(const QDate &newDate)

◆ createNavigationBar()

void QCalendarWidgetPrivate::createNavigationBar ( QWidget widget)

Definition at line 1688 of file qcalendarwidget.cpp.

1689 {
1691  navBarBackground = new QWidget(widget);
1692  navBarBackground->setObjectName(QLatin1String("qt_calendar_navigationbar"));
1695 
1698  prevMonth->setAutoRaise(true);
1699  nextMonth->setAutoRaise(true);
1702  nextMonth->setAutoRaise(true);
1704  prevMonth->setAutoRepeat(true);
1705  nextMonth->setAutoRepeat(true);
1706 
1709  monthButton->setAutoRaise(true);
1711  monthMenu = new QMenu(monthButton);
1712  for (int i = 1; i <= 12; i++) {
1713  QString monthName(q->locale().standaloneMonthName(i, QLocale::LongFormat));
1714  QAction *act = monthMenu->addAction(monthName);
1715  act->setData(i);
1716  monthToAction[i] = act;
1717  }
1721  yearButton->setAutoRaise(true);
1723 
1724  QFont font = q->font();
1725  font.setBold(true);
1726  monthButton->setFont(font);
1727  yearButton->setFont(font);
1728  yearEdit->setFrame(false);
1731  yearEdit->hide();
1732  spaceHolder = new QSpacerItem(0,0);
1733 
1734  QHBoxLayout *headerLayout = new QHBoxLayout;
1735  headerLayout->setMargin(0);
1736  headerLayout->setSpacing(0);
1737  headerLayout->addWidget(prevMonth);
1738  headerLayout->insertStretch(headerLayout->count());
1739  headerLayout->addWidget(monthButton);
1740  headerLayout->addItem(spaceHolder);
1741  headerLayout->addWidget(yearButton);
1742  headerLayout->insertStretch(headerLayout->count());
1743  headerLayout->addWidget(nextMonth);
1744  navBarBackground->setLayout(headerLayout);
1745 
1751 
1752  //set names for the header controls.
1753  prevMonth->setObjectName(QLatin1String("qt_calendar_prevmonth"));
1754  nextMonth->setObjectName(QLatin1String("qt_calendar_nextmonth"));
1755  monthButton->setObjectName(QLatin1String("qt_calendar_monthbutton"));
1756  yearButton->setObjectName(QLatin1String("qt_calendar_yearbutton"));
1757  yearEdit->setObjectName(QLatin1String("qt_calendar_yearedit"));
1758 
1759  updateMonthMenu();
1761 }
void setFont(const QFont &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4996
QCalToolButton * yearButton
void setLayout(QLayout *)
Sets the layout manager for this widget to layout.
Definition: qwidget.cpp:10104
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
QMap< int, QAction * > monthToAction
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
Definition: qdatetime.cpp:382
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void insertStretch(int index, int stretch=0)
Inserts a stretchable space (a QSpacerItem) at position index, with zero minimum size and stretch fac...
Definition: qboxlayout.cpp:960
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
QAction * addAction(const QString &text)
This convenience function creates a new action with text.
Definition: qmenu.cpp:1453
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
void setData(const QVariant &var)
Sets the action&#39;s internal data to the given userData.
Definition: qaction.cpp:1297
void addItem(QLayoutItem *)
Reimplemented Function
Definition: qboxlayout.cpp:894
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
void setAutoRepeat(bool)
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
void setBold(bool)
If enable is true sets the font&#39;s weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
Definition: qfont.h:352
The QSpacerItem class provides blank space in a layout.
Definition: qlayoutitem.h:96
int count() const
Reimplemented Function
Definition: qboxlayout.cpp:769
void hide()
Hides the widget.
Definition: qwidget.h:501
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setMenu(QMenu *menu)
Associates the given menu with this tool button.
void setSpacing(int spacing)
Reimplements QLayout::setSpacing().
Definition: qboxlayout.cpp:667
void setAutoRaise(bool enable)
The QSpinBox class provides a spin box widget.
Definition: qspinbox.h:56
QCalToolButton * monthButton
The QHBoxLayout class lines up widgets horizontally.
Definition: qboxlayout.h:129
void setPopupMode(ToolButtonPopupMode mode)
void showMonth(int year, int month)
int year() const
Returns the year of this date.
Definition: qdatetime.cpp:353
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
void setMinimum(int min)
Definition: qspinbox.cpp:425
void setMargin(int)
Definition: qlayout.cpp:464
void setMaximum(int max)
Definition: qspinbox.cpp:456
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
void setFocusPolicy(Qt::FocusPolicy policy)
Definition: qwidget.cpp:7631

◆ getCurrentDate()

QDate QCalendarWidgetPrivate::getCurrentDate ( )
inline

Definition at line 1834 of file qcalendarwidget.cpp.

Referenced by _q_monthChanged(), _q_nextMonthClicked(), _q_prevMonthClicked(), and _q_yearEditingFinished().

1835 {
1837  return m_model->dateForCell(index.row(), index.column());
1838 }
QDate dateForCell(int row, int column) const
int row() const
Returns the row this model index refers to.
QModelIndex currentIndex() const
Returns the model index of the current item.
The QModelIndex class is used to locate data in a data model.
quint16 index
int column() const
Returns the column this model index refers to.

◆ paintCell()

void QCalendarWidgetPrivate::paintCell ( QPainter painter,
const QRect rect,
const QDate date 
) const

Definition at line 1921 of file qcalendarwidget.cpp.

1922 {
1923  Q_Q(const QCalendarWidget);
1924  q->paintCell(painter, rect, date);
1925 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ setNavigatorEnabled()

void QCalendarWidgetPrivate::setNavigatorEnabled ( bool  enable)

Definition at line 1663 of file qcalendarwidget.cpp.

1664 {
1666 
1667  bool navigatorEnabled = (m_navigator->widget() != 0);
1668  if (enable == navigatorEnabled)
1669  return;
1670 
1671  if (enable) {
1672  m_navigator->setWidget(q);
1673  q->connect(m_navigator, SIGNAL(dateChanged(QDate)),
1675  q->connect(m_navigator, SIGNAL(editingFinished()),
1676  q, SLOT(_q_editingFinished()));
1678  } else {
1679  m_navigator->setWidget(0);
1680  q->disconnect(m_navigator, SIGNAL(dateChanged(QDate)),
1682  q->disconnect(m_navigator, SIGNAL(editingFinished()),
1683  q, SLOT(_q_editingFinished()));
1685  }
1686 }
void setWidget(QWidget *widget)
void _q_slotChangeDate(const QDate &date)
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
#define SLOT(a)
Definition: qobjectdefs.h:226
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
The QDate class provides date functions.
Definition: qdatetime.h:55
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidget * widget() const
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QCalendarTextNavigator * m_navigator
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070

◆ showMonth()

void QCalendarWidgetPrivate::showMonth ( int  year,
int  month 
)

Definition at line 1883 of file qcalendarwidget.cpp.

Referenced by _q_slotChangeDate(), createNavigationBar(), and updateCurrentPage().

1884 {
1885  if (m_model->m_shownYear == year && m_model->m_shownMonth == month)
1886  return;
1888  m_model->showMonth(year, month);
1890  emit q->currentPageChanged(year, month);
1892  cachedSizeHint = QSize();
1893  update();
1894  updateMonthMenu();
1895 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
void showMonth(int year, int month)
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ update()

void QCalendarWidgetPrivate::update ( )

Definition at line 1908 of file qcalendarwidget.cpp.

Referenced by _q_slotChangeDate(), and showMonth().

1909 {
1910  QDate currentDate = m_model->m_date;
1911  int row, column;
1912  m_model->cellForDate(currentDate, &row, &column);
1913  QModelIndex idx;
1914  m_selection->clear();
1915  if (row != -1 && column != -1) {
1916  idx = m_model->index(row, column);
1918  }
1919 }
virtual void clear()
Clears the selection model.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns the index of the data in row and column with parent.
The QDate class provides date functions.
Definition: qdatetime.h:55
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
QItemSelectionModel * m_selection
void cellForDate(const QDate &date, int *row, int *column) const
The QModelIndex class is used to locate data in a data model.

◆ updateButtonIcons()

void QCalendarWidgetPrivate::updateButtonIcons ( )

Definition at line 1763 of file qcalendarwidget.cpp.

Referenced by createNavigationBar().

1764 {
1766  prevMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowRight : QStyle::SP_ArrowLeft, 0, q));
1767  nextMonth->setIcon(q->style()->standardIcon(q->isRightToLeft() ? QStyle::SP_ArrowLeft : QStyle::SP_ArrowRight, 0, q));
1768 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
#define Q_Q(Class)
Definition: qglobal.h:2483
void setIcon(const QIcon &icon)

◆ updateCurrentPage()

void QCalendarWidgetPrivate::updateCurrentPage ( const QDate newDate)

Definition at line 1805 of file qcalendarwidget.cpp.

Referenced by _q_monthChanged(), _q_nextMonthClicked(), _q_prevMonthClicked(), _q_slotShowDate(), and _q_yearEditingFinished().

1806 {
1808 
1809  QDate newDate = date;
1810  QDate minDate = q->minimumDate();
1811  QDate maxDate = q->maximumDate();
1812  if (minDate.isValid()&& minDate.daysTo(newDate) < 0)
1813  newDate = minDate;
1814  if (maxDate.isValid()&& maxDate.daysTo(newDate) > 0)
1815  newDate = maxDate;
1816  showMonth(newDate.year(), newDate.month());
1817  int row = -1, col = -1;
1818  m_model->cellForDate(newDate, &row, &col);
1819  if (row != -1 && col != -1)
1820  {
1823  }
1824 }
int daysTo(const QDate &) const
Returns the number of days from this date to d (which is negative if d is earlier than this date)...
Definition: qdatetime.cpp:1111
bool isValid() const
Returns true if this date is valid; otherwise returns false.
Definition: qdatetime.cpp:340
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
Definition: qdatetime.cpp:382
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns the index of the data in row and column with parent.
The QDate class provides date functions.
Definition: qdatetime.h:55
#define Q_Q(Class)
Definition: qglobal.h:2483
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void cellForDate(const QDate &date, int *row, int *column) const
void showMonth(int year, int month)
int year() const
Returns the year of this date.
Definition: qdatetime.cpp:353

◆ updateMonthMenu()

void QCalendarWidgetPrivate::updateMonthMenu ( )

Definition at line 1770 of file qcalendarwidget.cpp.

Referenced by createNavigationBar(), and showMonth().

1771 {
1772  int beg = 1, end = 12;
1773  bool prevEnabled = true;
1774  bool nextEnabled = true;
1776  beg = m_model->m_minimumDate.month();
1778  prevEnabled = false;
1779  }
1783  nextEnabled = false;
1784  }
1785  prevMonth->setEnabled(prevEnabled);
1786  nextMonth->setEnabled(nextEnabled);
1787  for (int i = 1; i <= 12; i++) {
1788  bool monthEnabled = true;
1789  if (i < beg || i > end)
1790  monthEnabled = false;
1791  monthToAction[i]->setEnabled(monthEnabled);
1792  }
1793 }
QMap< int, QAction * > monthToAction
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
Definition: qdatetime.cpp:382
void setEnabled(bool)
Definition: qwidget.cpp:3447
int year() const
Returns the year of this date.
Definition: qdatetime.cpp:353
static const KeyPair *const end

◆ updateMonthMenuNames()

void QCalendarWidgetPrivate::updateMonthMenuNames ( )

Definition at line 1795 of file qcalendarwidget.cpp.

1796 {
1798 
1799  for (int i = 1; i <= 12; i++) {
1800  QString monthName(q->locale().standaloneMonthName(i, QLocale::LongFormat));
1801  monthToAction[i]->setText(monthName);
1802  }
1803 }
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
QMap< int, QAction * > monthToAction
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ updateNavigationBar()

void QCalendarWidgetPrivate::updateNavigationBar ( )

Definition at line 1897 of file qcalendarwidget.cpp.

Referenced by showMonth().

1898 {
1900 
1901  QString monthName = q->locale().standaloneMonthName(m_model->m_shownMonth, QLocale::LongFormat);
1902 
1903  monthButton->setText(monthName);
1906 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
void setText(const QString &text)
QCalToolButton * yearButton
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
void setValue(int val)
Definition: qspinbox.cpp:268
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
QCalToolButton * monthButton

Properties

◆ cachedSizeHint

QSize QCalendarWidgetPrivate::cachedSizeHint
mutable

Definition at line 1623 of file qcalendarwidget.cpp.

Referenced by showMonth().

◆ m_dateEditEnabled

bool QCalendarWidgetPrivate::m_dateEditEnabled

Definition at line 1610 of file qcalendarwidget.cpp.

Referenced by QCalendarWidgetPrivate().

◆ m_delegate

QCalendarDelegate* QCalendarWidgetPrivate::m_delegate

Definition at line 1607 of file qcalendarwidget.cpp.

Referenced by QCalendarWidgetPrivate().

◆ m_model

QCalendarModel* QCalendarWidgetPrivate::m_model

◆ m_navigator

QCalendarTextNavigator* QCalendarWidgetPrivate::m_navigator

◆ m_selection

QItemSelectionModel* QCalendarWidgetPrivate::m_selection

Definition at line 1608 of file qcalendarwidget.cpp.

Referenced by QCalendarWidgetPrivate(), and update().

◆ m_view

QCalendarView* QCalendarWidgetPrivate::m_view

◆ monthButton

QCalToolButton* QCalendarWidgetPrivate::monthButton

Definition at line 1614 of file qcalendarwidget.cpp.

Referenced by _q_monthChanged(), createNavigationBar(), and updateNavigationBar().

◆ monthMenu

QMenu* QCalendarWidgetPrivate::monthMenu

Definition at line 1615 of file qcalendarwidget.cpp.

Referenced by createNavigationBar().

◆ monthToAction

QMap<int, QAction *> QCalendarWidgetPrivate::monthToAction

◆ navBarBackground

QWidget* QCalendarWidgetPrivate::navBarBackground

Definition at line 1619 of file qcalendarwidget.cpp.

Referenced by createNavigationBar().

◆ navBarVisible

bool QCalendarWidgetPrivate::navBarVisible

Definition at line 1622 of file qcalendarwidget.cpp.

Referenced by QCalendarWidgetPrivate().

◆ nextMonth

QToolButton* QCalendarWidgetPrivate::nextMonth

Definition at line 1612 of file qcalendarwidget.cpp.

Referenced by createNavigationBar(), updateButtonIcons(), and updateMonthMenu().

◆ oldFocusPolicy

Qt::FocusPolicy QCalendarWidgetPrivate::oldFocusPolicy

◆ prevMonth

QToolButton* QCalendarWidgetPrivate::prevMonth

Definition at line 1613 of file qcalendarwidget.cpp.

Referenced by createNavigationBar(), updateButtonIcons(), and updateMonthMenu().

◆ spaceHolder

QSpacerItem* QCalendarWidgetPrivate::spaceHolder

◆ yearButton

QCalToolButton* QCalendarWidgetPrivate::yearButton

◆ yearEdit

QSpinBox* QCalendarWidgetPrivate::yearEdit

The documentation for this class was generated from the following file: