Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qcalendarwidget.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QCALENDARWIDGET_H
0005 #define QCALENDARWIDGET_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qwidget.h>
0009 #include <QtCore/qdatetime.h>
0010 
0011 QT_REQUIRE_CONFIG(calendarwidget);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QDate;
0016 class QTextCharFormat;
0017 class QCalendarWidgetPrivate;
0018 
0019 class Q_WIDGETS_EXPORT QCalendarWidget : public QWidget
0020 {
0021     Q_OBJECT
0022     Q_ENUMS(Qt::DayOfWeek)
0023     Q_PROPERTY(QDate selectedDate READ selectedDate WRITE setSelectedDate)
0024     Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET clearMinimumDate)
0025     Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET clearMaximumDate)
0026     Q_PROPERTY(Qt::DayOfWeek firstDayOfWeek READ firstDayOfWeek WRITE setFirstDayOfWeek)
0027     Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible)
0028     Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
0029     Q_PROPERTY(HorizontalHeaderFormat horizontalHeaderFormat READ horizontalHeaderFormat
0030                WRITE setHorizontalHeaderFormat)
0031     Q_PROPERTY(VerticalHeaderFormat verticalHeaderFormat READ verticalHeaderFormat
0032                WRITE setVerticalHeaderFormat)
0033     Q_PROPERTY(bool navigationBarVisible READ isNavigationBarVisible WRITE setNavigationBarVisible)
0034     Q_PROPERTY(bool dateEditEnabled READ isDateEditEnabled WRITE setDateEditEnabled)
0035     Q_PROPERTY(int dateEditAcceptDelay READ dateEditAcceptDelay WRITE setDateEditAcceptDelay)
0036 
0037 public:
0038     enum HorizontalHeaderFormat {
0039         NoHorizontalHeader,
0040         SingleLetterDayNames,
0041         ShortDayNames,
0042         LongDayNames
0043     };
0044     Q_ENUM(HorizontalHeaderFormat)
0045 
0046     enum VerticalHeaderFormat {
0047         NoVerticalHeader,
0048         ISOWeekNumbers
0049     };
0050     Q_ENUM(VerticalHeaderFormat)
0051 
0052     enum SelectionMode {
0053         NoSelection,
0054         SingleSelection
0055     };
0056     Q_ENUM(SelectionMode)
0057 
0058     explicit QCalendarWidget(QWidget *parent = nullptr);
0059     ~QCalendarWidget();
0060 
0061     virtual QSize sizeHint() const override;
0062     virtual QSize minimumSizeHint() const override;
0063 
0064     QDate selectedDate() const;
0065 
0066     int yearShown() const;
0067     int monthShown() const;
0068 
0069     QDate minimumDate() const;
0070     void setMinimumDate(QDate date);
0071     void clearMinimumDate();
0072 
0073     QDate maximumDate() const;
0074     void setMaximumDate(QDate date);
0075     void clearMaximumDate();
0076 
0077     Qt::DayOfWeek firstDayOfWeek() const;
0078     void setFirstDayOfWeek(Qt::DayOfWeek dayOfWeek);
0079 
0080     bool isNavigationBarVisible() const;
0081     bool isGridVisible() const;
0082 
0083     QCalendar calendar() const;
0084     void setCalendar(QCalendar calendar);
0085 
0086     SelectionMode selectionMode() const;
0087     void setSelectionMode(SelectionMode mode);
0088 
0089     HorizontalHeaderFormat horizontalHeaderFormat() const;
0090     void setHorizontalHeaderFormat(HorizontalHeaderFormat format);
0091 
0092     VerticalHeaderFormat verticalHeaderFormat() const;
0093     void setVerticalHeaderFormat(VerticalHeaderFormat format);
0094 
0095     QTextCharFormat headerTextFormat() const;
0096     void setHeaderTextFormat(const QTextCharFormat &format);
0097 
0098     QTextCharFormat weekdayTextFormat(Qt::DayOfWeek dayOfWeek) const;
0099     void setWeekdayTextFormat(Qt::DayOfWeek dayOfWeek, const QTextCharFormat &format);
0100 
0101     QMap<QDate, QTextCharFormat> dateTextFormat() const;
0102     QTextCharFormat dateTextFormat(QDate date) const;
0103     void setDateTextFormat(QDate date, const QTextCharFormat &format);
0104 
0105     bool isDateEditEnabled() const;
0106     void setDateEditEnabled(bool enable);
0107 
0108     int dateEditAcceptDelay() const;
0109     void setDateEditAcceptDelay(int delay);
0110 
0111 protected:
0112     bool event(QEvent *event) override;
0113     bool eventFilter(QObject *watched, QEvent *event) override;
0114     void mousePressEvent(QMouseEvent *event) override;
0115     void resizeEvent(QResizeEvent * event) override;
0116     void keyPressEvent(QKeyEvent * event) override;
0117 
0118     virtual void paintCell(QPainter *painter, const QRect &rect, QDate date) const;
0119     void updateCell(QDate date);
0120     void updateCells();
0121 
0122 public Q_SLOTS:
0123     void setSelectedDate(QDate date);
0124     void setDateRange(QDate min, QDate max);
0125     void setCurrentPage(int year, int month);
0126     void setGridVisible(bool show);
0127     void setNavigationBarVisible(bool visible);
0128     void showNextMonth();
0129     void showPreviousMonth();
0130     void showNextYear();
0131     void showPreviousYear();
0132     void showSelectedDate();
0133     void showToday();
0134 
0135 Q_SIGNALS:
0136     void selectionChanged();
0137     void clicked(QDate date);
0138     void activated(QDate date);
0139     void currentPageChanged(int year, int month);
0140 
0141 private:
0142     Q_DECLARE_PRIVATE(QCalendarWidget)
0143     Q_DISABLE_COPY(QCalendarWidget)
0144 
0145     Q_PRIVATE_SLOT(d_func(), void _q_slotShowDate(QDate date))
0146     Q_PRIVATE_SLOT(d_func(), void _q_slotChangeDate(QDate date))
0147     Q_PRIVATE_SLOT(d_func(), void _q_slotChangeDate(QDate date, bool changeMonth))
0148     Q_PRIVATE_SLOT(d_func(), void _q_editingFinished())
0149     Q_PRIVATE_SLOT(d_func(), void _q_prevMonthClicked())
0150     Q_PRIVATE_SLOT(d_func(), void _q_nextMonthClicked())
0151     Q_PRIVATE_SLOT(d_func(), void _q_yearEditingFinished())
0152     Q_PRIVATE_SLOT(d_func(), void _q_yearClicked())
0153     Q_PRIVATE_SLOT(d_func(), void _q_monthChanged(QAction *act))
0154 
0155 };
0156 
0157 QT_END_NAMESPACE
0158 
0159 #endif // QCALENDARWIDGET_H