Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdesigner_stackedbox_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header
11// file may change from version to version without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QDESIGNER_STACKEDBOX_H
17#define QDESIGNER_STACKEDBOX_H
18
21
23
24class QStackedWidget;
25class QWidget;
26class QAction;
27class QMenu;
28class QToolButton;
29
30namespace qdesigner_internal {
31 class PromotionTaskMenu;
32}
33
34// Event filter to be installed on a QStackedWidget in preview mode.
35// Create two buttons to switch pages.
36
38{
39 Q_OBJECT
40public:
41 explicit QStackedWidgetPreviewEventFilter(QStackedWidget *parent);
42
43 // Install helper on QStackedWidget
44 static void install(QStackedWidget *stackedWidget);
45 bool eventFilter(QObject *watched, QEvent *event) override;
46
47 void setButtonToolTipEnabled(bool v) { m_buttonToolTipEnabled = v; }
48 bool buttonToolTipEnabled() const { return m_buttonToolTipEnabled; }
49
50public slots:
51 void updateButtons();
52 void prevPage();
53 void nextPage();
54
55protected:
56 QStackedWidget *stackedWidget() const { return m_stackedWidget; }
57 virtual void gotoPage(int page);
58
59private:
60 void updateButtonToolTip(QObject *o);
61
62 bool m_buttonToolTipEnabled;
63 QStackedWidget *m_stackedWidget;
64 QToolButton *m_prev;
65 QToolButton *m_next;
66};
67
68// Event filter to be installed on a QStackedWidget in editing mode.
69// In addition to the browse buttons, handles context menu and everything
70
71class QDESIGNER_SHARED_EXPORT QStackedWidgetEventFilter : public QStackedWidgetPreviewEventFilter
72{
73 Q_OBJECT
74public:
75 explicit QStackedWidgetEventFilter(QStackedWidget *parent);
76
77 // Install helper on QStackedWidget
78 static void install(QStackedWidget *stackedWidget);
79 static QStackedWidgetEventFilter *eventFilterOf(const QStackedWidget *stackedWidget);
80 // Convenience to add a menu on a tackedWidget
81 static QMenu *addStackedWidgetContextMenuActions(const QStackedWidget *stackedWidget, QMenu *popup);
82
83 // Add context menu and return page submenu or 0.
84 QMenu *addContextMenuActions(QMenu *popup);
85
86private slots:
87 void removeCurrentPage();
88 void addPage();
89 void addPageAfter();
90 void changeOrder();
91
92protected:
93 void gotoPage(int page) override;
94
95private:
96 QAction *m_actionPreviousPage;
97 QAction *m_actionNextPage;
98 QAction *m_actionDeletePage;
99 QAction *m_actionInsertPage;
100 QAction *m_actionInsertPageAfter;
101 QAction *m_actionChangePageOrder;
102 qdesigner_internal::PromotionTaskMenu* m_pagePromotionTaskMenu;
103};
104
105// PropertySheet to handle the "currentPageName" property
106class QDESIGNER_SHARED_EXPORT QStackedWidgetPropertySheet : public QDesignerPropertySheet {
107public:
108 explicit QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent = nullptr);
109
110 void setProperty(int index, const QVariant &value) override;
111 QVariant property(int index) const override;
112 bool reset(int index) override;
113 bool isEnabled(int index) const override;
114
115 // Check whether the property is to be saved. Returns false for the page
116 // properties (as the property sheet has no concept of 'stored')
117 static bool checkProperty(const QString &propertyName);
118
119private:
120 QStackedWidget *m_stackedWidget;
121};
122
123using QStackedWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QStackedWidget, QStackedWidgetPropertySheet>;
124
125QT_END_NAMESPACE
126
127#endif // QDESIGNER_STACKEDBOX_H
virtual bool dynamicPropertiesAllowed() const =0
virtual bool isDynamicProperty(int index) const =0
virtual int addDynamicProperty(const QString &propertyName, const QVariant &value)=0
virtual bool canAddDynamicProperty(const QString &propertyName) const =0
virtual bool removeDynamicProperty(int index)=0
virtual ~QDesignerDynamicPropertySheetExtension()=default
QDesignerPropertySheetFactory(QExtensionManager *parent=nullptr)
static void registerExtension(QExtensionManager *mgr)
friend class QWidget
Definition qpainter.h:432
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
QWidget * createPage(QWidget *parent) override
FormEditor(const QStringList &pluginPaths, QObject *parent=nullptr)
void setProperty(int index, const QVariant &value) override
void setChanged(int index, bool changed) override
QVariant property(int index) const override
QString propertyGroup(int index) const override
bool isVisible(int index) const override
void setProperty(int index, const QVariant &value) override
void setProperty(int index, const QVariant &value) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void addWidget(QWidget *widget) override
static void positionNewMdiChild(const QWidget *area, QWidget *mdiChild)
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void setProperty(int index, const QVariant &value) override
static bool checkProperty(const QString &propertyName)
QVariant property(int index) const override
void addWidget(QWidget *widget) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
bool isVisible(int index) const override
void setProperty(int index, const QVariant &value) override
QWidget * createPage(QWidget *parent) override
static QString chooseTemplatePath(QDesignerFormEditorInterface *core, QWidget *parent)
#define QT_FORMEDITOR_EXPORT
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
QDesignerPropertySheetFactory< QWizardPage, QWizardPagePropertySheet > QWizardPagePropertySheetFactory
#define QDESIGNER_SHARED_EXPORT