Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qdatetimeedit.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 QDATETIMEEDIT_H
0005 #define QDATETIMEEDIT_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qtimezone.h>
0009 #include <QtCore/qcalendar.h>
0010 #include <QtCore/qvariant.h>
0011 #include <QtWidgets/qabstractspinbox.h>
0012 
0013 QT_REQUIRE_CONFIG(datetimeedit);
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 class QDateTimeEditPrivate;
0018 class QStyleOptionSpinBox;
0019 class QCalendarWidget;
0020 
0021 class Q_WIDGETS_EXPORT QDateTimeEdit : public QAbstractSpinBox
0022 {
0023     Q_OBJECT
0024 
0025     Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true)
0026     Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged)
0027     Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged)
0028     Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime WRITE setMaximumDateTime
0029                RESET clearMaximumDateTime)
0030     Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime WRITE setMinimumDateTime
0031                RESET clearMinimumDateTime)
0032     Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET clearMaximumDate)
0033     Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET clearMinimumDate)
0034     Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime RESET clearMaximumTime)
0035     Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime RESET clearMinimumTime)
0036     Q_PROPERTY(Section currentSection READ currentSection WRITE setCurrentSection)
0037     Q_PROPERTY(Sections displayedSections READ displayedSections)
0038     Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
0039     Q_PROPERTY(bool calendarPopup READ calendarPopup WRITE setCalendarPopup)
0040     Q_PROPERTY(int currentSectionIndex READ currentSectionIndex WRITE setCurrentSectionIndex)
0041     Q_PROPERTY(int sectionCount READ sectionCount)
0042 #if QT_DEPRECATED_SINCE(6, 10)
0043     Q_PROPERTY(Qt::TimeSpec timeSpec READ timeSpec WRITE setTimeSpec)
0044 #endif
0045     Q_PROPERTY(QTimeZone timeZone READ timeZone WRITE setTimeZone)
0046 public:
0047     enum Section { // a sub-type of QDateTimeParser's like-named enum.
0048         NoSection = 0x0000,
0049         AmPmSection = 0x0001,
0050         MSecSection = 0x0002,
0051         SecondSection = 0x0004,
0052         MinuteSection = 0x0008,
0053         HourSection   = 0x0010,
0054         DaySection    = 0x0100,
0055         MonthSection  = 0x0200,
0056         YearSection   = 0x0400,
0057         TimeSections_Mask = AmPmSection|MSecSection|SecondSection|MinuteSection|HourSection,
0058         DateSections_Mask = DaySection|MonthSection|YearSection
0059     };
0060     Q_ENUM(Section)
0061 
0062     Q_DECLARE_FLAGS(Sections, Section)
0063     Q_FLAG(Sections)
0064 
0065     explicit QDateTimeEdit(QWidget *parent = nullptr);
0066     explicit QDateTimeEdit(const QDateTime &dt, QWidget *parent = nullptr);
0067     explicit QDateTimeEdit(QDate d, QWidget *parent = nullptr);
0068     explicit QDateTimeEdit(QTime t, QWidget *parent = nullptr);
0069     ~QDateTimeEdit();
0070 
0071     QDateTime dateTime() const;
0072     QDate date() const;
0073     QTime time() const;
0074 
0075     QCalendar calendar() const;
0076     void setCalendar(QCalendar calendar);
0077 
0078     QDateTime minimumDateTime() const;
0079     void clearMinimumDateTime();
0080     void setMinimumDateTime(const QDateTime &dt);
0081 
0082     QDateTime maximumDateTime() const;
0083     void clearMaximumDateTime();
0084     void setMaximumDateTime(const QDateTime &dt);
0085 
0086     void setDateTimeRange(const QDateTime &min, const QDateTime &max);
0087 
0088     QDate minimumDate() const;
0089     void setMinimumDate(QDate min);
0090     void clearMinimumDate();
0091 
0092     QDate maximumDate() const;
0093     void setMaximumDate(QDate max);
0094     void clearMaximumDate();
0095 
0096     void setDateRange(QDate min, QDate max);
0097 
0098     QTime minimumTime() const;
0099     void setMinimumTime(QTime min);
0100     void clearMinimumTime();
0101 
0102     QTime maximumTime() const;
0103     void setMaximumTime(QTime max);
0104     void clearMaximumTime();
0105 
0106     void setTimeRange(QTime min, QTime max);
0107 
0108     Sections displayedSections() const;
0109     Section currentSection() const;
0110     Section sectionAt(int index) const;
0111     void setCurrentSection(Section section);
0112 
0113     int currentSectionIndex() const;
0114     void setCurrentSectionIndex(int index);
0115 
0116     QCalendarWidget *calendarWidget() const;
0117     void setCalendarWidget(QCalendarWidget *calendarWidget);
0118 
0119     int sectionCount() const;
0120 
0121     void setSelectedSection(Section section);
0122 
0123     QString sectionText(Section section) const;
0124 
0125     QString displayFormat() const;
0126     void setDisplayFormat(const QString &format);
0127 
0128     bool calendarPopup() const;
0129     void setCalendarPopup(bool enable);
0130 
0131 #if QT_DEPRECATED_SINCE(6, 10)
0132     QT_DEPRECATED_VERSION_X_6_10("Use timeZone() instead")
0133     Qt::TimeSpec timeSpec() const;
0134     QT_DEPRECATED_VERSION_X_6_10("Use setTimeZone() instead")
0135     void setTimeSpec(Qt::TimeSpec spec);
0136 #endif
0137     QTimeZone timeZone() const;
0138     void setTimeZone(const QTimeZone &zone);
0139 
0140     QSize sizeHint() const override;
0141 
0142     void clear() override;
0143     void stepBy(int steps) override;
0144 
0145     bool event(QEvent *event) override;
0146 Q_SIGNALS:
0147     void dateTimeChanged(const QDateTime &dateTime);
0148     void timeChanged(QTime time);
0149     void dateChanged(QDate date);
0150 
0151 public Q_SLOTS:
0152     void setDateTime(const QDateTime &dateTime);
0153     void setDate(QDate date);
0154     void setTime(QTime time);
0155 
0156 protected:
0157     void keyPressEvent(QKeyEvent *event) override;
0158 #if QT_CONFIG(wheelevent)
0159     void wheelEvent(QWheelEvent *event) override;
0160 #endif
0161     void focusInEvent(QFocusEvent *event) override;
0162     bool focusNextPrevChild(bool next) override;
0163     QValidator::State validate(QString &input, int &pos) const override;
0164     void fixup(QString &input) const override;
0165 
0166     virtual QDateTime dateTimeFromText(const QString &text) const;
0167     virtual QString textFromDateTime(const QDateTime &dt) const;
0168     StepEnabled stepEnabled() const override;
0169     void mousePressEvent(QMouseEvent *event) override;
0170     void paintEvent(QPaintEvent *event) override;
0171     void initStyleOption(QStyleOptionSpinBox *option) const override;
0172 
0173     QDateTimeEdit(const QVariant &val, QMetaType::Type parserType, QWidget *parent = nullptr);
0174 private:
0175     Q_DECLARE_PRIVATE(QDateTimeEdit)
0176     Q_DISABLE_COPY(QDateTimeEdit)
0177 
0178     Q_PRIVATE_SLOT(d_func(), void _q_resetButton())
0179 };
0180 
0181 class Q_WIDGETS_EXPORT QTimeEdit : public QDateTimeEdit
0182 {
0183     Q_OBJECT
0184     Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY userTimeChanged USER true)
0185 public:
0186     explicit QTimeEdit(QWidget *parent = nullptr);
0187     explicit QTimeEdit(QTime time, QWidget *parent = nullptr);
0188     ~QTimeEdit();
0189 
0190 Q_SIGNALS:
0191     void userTimeChanged(QTime time);
0192 };
0193 
0194 class Q_WIDGETS_EXPORT QDateEdit : public QDateTimeEdit
0195 {
0196     Q_OBJECT
0197     Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY userDateChanged USER true)
0198 public:
0199     explicit QDateEdit(QWidget *parent = nullptr);
0200     explicit QDateEdit(QDate date, QWidget *parent = nullptr);
0201     ~QDateEdit();
0202 
0203 Q_SIGNALS:
0204     void userDateChanged(QDate date);
0205 };
0206 
0207 Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections)
0208 
0209 QT_END_NAMESPACE
0210 
0211 #endif // QDATETIMEEDIT_H