1 | // Copyright (C) 2018 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef DATETIMEAXISLABEL_H |
14 | #define DATETIMEAXISLABEL_H |
15 | |
16 | #include <private/editableaxislabel_p.h> |
17 | |
18 | #include <QtCore/qdatetime.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class Q_CHARTS_PRIVATE_EXPORT DateTimeAxisLabel : public EditableAxisLabel |
23 | { |
24 | Q_OBJECT |
25 | public: |
26 | DateTimeAxisLabel(QGraphicsItem *parent = nullptr); |
27 | |
28 | void keyPressEvent(QKeyEvent *event) override; |
29 | |
30 | QDateTime value() const; |
31 | void setValue(const QDateTime &value); |
32 | void setFormat(const QString &format); |
33 | |
34 | private: |
35 | QDateTime m_dateTime; |
36 | QDateTime m_dateTimeBeforeEdit; |
37 | QString m_format; |
38 | |
39 | void setInitialEditValue() override; |
40 | void finishEditing() override; |
41 | void resetBeforeEditValue() override; |
42 | |
43 | Q_SIGNALS: |
44 | void dateTimeChanged(const QDateTime &oldDateTime, const QDateTime &newDateTime); |
45 | }; |
46 | |
47 | QT_END_NAMESPACE |
48 | |
49 | #endif // VALUEAXISLABEL_H |
50 | |