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 QWIDGETACTION_H |
5 | #define QWIDGETACTION_H |
6 | |
7 | #include <QtWidgets/qtwidgetsglobal.h> |
8 | #include <QtGui/qaction.h> |
9 | |
10 | QT_REQUIRE_CONFIG(action); |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QWidgetActionPrivate; |
15 | |
16 | class Q_WIDGETS_EXPORT QWidgetAction : public QAction |
17 | { |
18 | Q_OBJECT |
19 | Q_DECLARE_PRIVATE(QWidgetAction) |
20 | |
21 | public: |
22 | explicit QWidgetAction(QObject *parent); |
23 | virtual ~QWidgetAction(); |
24 | |
25 | void setDefaultWidget(QWidget *w); |
26 | QWidget *defaultWidget() const; |
27 | |
28 | QWidget *requestWidget(QWidget *parent); |
29 | void releaseWidget(QWidget *widget); |
30 | |
31 | protected: |
32 | virtual bool event(QEvent *) override; |
33 | virtual bool eventFilter(QObject *, QEvent *) override; |
34 | virtual QWidget *createWidget(QWidget *parent); |
35 | virtual void deleteWidget(QWidget *widget); |
36 | QList<QWidget *> createdWidgets() const; |
37 | |
38 | private: |
39 | Q_DISABLE_COPY(QWidgetAction) |
40 | Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *)) |
41 | friend class QToolBar; |
42 | }; |
43 | |
44 | QT_END_NAMESPACE |
45 | |
46 | #endif // QWIDGETACTION_H |
47 |