| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QPUSHBUTTON_P_H |
| 5 | #define QPUSHBUTTON_P_H |
| 6 | |
| 7 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
| 8 | #include "private/qabstractbutton_p.h" |
| 9 | |
| 10 | #include <QtCore/qpointer.h> |
| 11 | |
| 12 | QT_REQUIRE_CONFIG(pushbutton); |
| 13 | |
| 14 | // |
| 15 | // W A R N I N G |
| 16 | // ------------- |
| 17 | // |
| 18 | // This file is not part of the Qt API. It exists purely as an |
| 19 | // implementation detail. This header file may change from version to |
| 20 | // version without notice, or even be removed. |
| 21 | // |
| 22 | // We mean it. |
| 23 | // |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QDialog; |
| 28 | class QPushButton; |
| 29 | |
| 30 | class QPushButtonPrivate : public QAbstractButtonPrivate |
| 31 | { |
| 32 | Q_DECLARE_PUBLIC(QPushButton) |
| 33 | public: |
| 34 | enum AutoDefaultValue { Off = 0, On = 1, Auto = 2 }; |
| 35 | |
| 36 | QPushButtonPrivate() |
| 37 | : QAbstractButtonPrivate(QSizePolicy::PushButton), autoDefault(Auto), |
| 38 | defaultButton(false), flat(false), menuOpen(false), hovering(false), |
| 39 | lastAutoDefault(false) |
| 40 | {} |
| 41 | |
| 42 | void init(); |
| 43 | static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); } |
| 44 | #if QT_CONFIG(menu) |
| 45 | QPoint adjustedMenuPosition(); |
| 46 | #endif |
| 47 | void resetLayoutItemMargins(); |
| 48 | void popupPressed(); |
| 49 | #if QT_CONFIG(dialog) |
| 50 | QDialog *dialogParent() const; |
| 51 | #else |
| 52 | QDialog *dialogParent() const { return nullptr; } |
| 53 | #endif |
| 54 | |
| 55 | QPointer<QMenu> menu; |
| 56 | uint autoDefault : 2; |
| 57 | uint defaultButton : 1; |
| 58 | uint flat : 1; |
| 59 | uint menuOpen : 1; |
| 60 | uint hovering : 1; |
| 61 | mutable uint lastAutoDefault : 1; |
| 62 | }; |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif // QPUSHBUTTON_P_H |
| 67 |
