| 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 QSTATUSBAR_H |
| 5 | #define QSTATUSBAR_H |
| 6 | |
| 7 | #include <QtWidgets/qtwidgetsglobal.h> |
| 8 | #include <QtWidgets/qwidget.h> |
| 9 | |
| 10 | QT_REQUIRE_CONFIG(statusbar); |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QStatusBarPrivate; |
| 15 | |
| 16 | class Q_WIDGETS_EXPORT QStatusBar: public QWidget |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | |
| 20 | Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled) |
| 21 | |
| 22 | public: |
| 23 | explicit QStatusBar(QWidget *parent = nullptr); |
| 24 | virtual ~QStatusBar(); |
| 25 | |
| 26 | void addWidget(QWidget *widget, int stretch = 0); |
| 27 | int insertWidget(int index, QWidget *widget, int stretch = 0); |
| 28 | void addPermanentWidget(QWidget *widget, int stretch = 0); |
| 29 | int insertPermanentWidget(int index, QWidget *widget, int stretch = 0); |
| 30 | void removeWidget(QWidget *widget); |
| 31 | |
| 32 | void setSizeGripEnabled(bool); |
| 33 | bool isSizeGripEnabled() const; |
| 34 | |
| 35 | QString currentMessage() const; |
| 36 | |
| 37 | public Q_SLOTS: |
| 38 | void showMessage(const QString &text, int timeout = 0); |
| 39 | void clearMessage(); |
| 40 | |
| 41 | |
| 42 | Q_SIGNALS: |
| 43 | void messageChanged(const QString &text); |
| 44 | |
| 45 | protected: |
| 46 | void showEvent(QShowEvent *) override; |
| 47 | void paintEvent(QPaintEvent *) override; |
| 48 | void resizeEvent(QResizeEvent *) override; |
| 49 | |
| 50 | void reformat(); |
| 51 | void hideOrShow(); |
| 52 | bool event(QEvent *) override; |
| 53 | |
| 54 | private: |
| 55 | Q_DISABLE_COPY(QStatusBar) |
| 56 | Q_DECLARE_PRIVATE(QStatusBar) |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif // QSTATUSBAR_H |
| 62 | |