| 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 QCOMMANDLINKBUTTON_H |
| 5 | #define QCOMMANDLINKBUTTON_H |
| 6 | |
| 7 | #include <QtWidgets/qtwidgetsglobal.h> |
| 8 | #include <QtWidgets/qpushbutton.h> |
| 9 | |
| 10 | QT_REQUIRE_CONFIG(commandlinkbutton); |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | |
| 15 | class QCommandLinkButtonPrivate; |
| 16 | |
| 17 | class Q_WIDGETS_EXPORT QCommandLinkButton: public QPushButton |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | |
| 21 | Q_PROPERTY(QString description READ description WRITE setDescription) |
| 22 | Q_PROPERTY(bool flat READ isFlat WRITE setFlat DESIGNABLE false) |
| 23 | |
| 24 | public: |
| 25 | explicit QCommandLinkButton(QWidget *parent = nullptr); |
| 26 | explicit QCommandLinkButton(const QString &text, QWidget *parent = nullptr); |
| 27 | explicit QCommandLinkButton(const QString &text, const QString &description, QWidget *parent = nullptr); |
| 28 | ~QCommandLinkButton(); |
| 29 | |
| 30 | QString description() const; |
| 31 | void setDescription(const QString &description); |
| 32 | |
| 33 | QSize sizeHint() const override; |
| 34 | int heightForWidth(int) const override; |
| 35 | QSize minimumSizeHint() const override; |
| 36 | void initStyleOption(QStyleOptionButton *option) const override; |
| 37 | |
| 38 | protected: |
| 39 | bool event(QEvent *e) override; |
| 40 | void paintEvent(QPaintEvent *) override; |
| 41 | |
| 42 | private: |
| 43 | Q_DISABLE_COPY(QCommandLinkButton) |
| 44 | Q_DECLARE_PRIVATE(QCommandLinkButton) |
| 45 | }; |
| 46 | |
| 47 | QT_END_NAMESPACE |
| 48 | |
| 49 | #endif // QCOMMANDLINKBUTTON |
| 50 | |