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
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header
10// file may change from version to version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef QDESIGNER_STACKEDBOX_H
16#define QDESIGNER_STACKEDBOX_H
17
20
22
23class QStackedWidget;
24class QWidget;
25class QAction;
26class QMenu;
27class QToolButton;
28
29namespace qdesigner_internal {
30 class PromotionTaskMenu;
31}
32
33// Event filter to be installed on a QStackedWidget in preview mode.
34// Create two buttons to switch pages.
35
37{
38 Q_OBJECT
39public:
40 explicit QStackedWidgetPreviewEventFilter(QStackedWidget *parent);
41
42 // Install helper on QStackedWidget
43 static void install(QStackedWidget *stackedWidget);
44 bool eventFilter(QObject *watched, QEvent *event) override;
45
46 void setButtonToolTipEnabled(bool v) { m_buttonToolTipEnabled = v; }
47 bool buttonToolTipEnabled() const { return m_buttonToolTipEnabled; }
48
49public slots:
50 void updateButtons();
51 void prevPage();
52 void nextPage();
53
54protected:
55 QStackedWidget *stackedWidget() const { return m_stackedWidget; }
56 virtual void gotoPage(int page);
57
58private:
59 void updateButtonToolTip(QObject *o);
60
61 bool m_buttonToolTipEnabled;
62 QStackedWidget *m_stackedWidget;
63 QToolButton *m_prev;
64 QToolButton *m_next;
65};
66
67// Event filter to be installed on a QStackedWidget in editing mode.
68// In addition to the browse buttons, handles context menu and everything
69
70class QDESIGNER_SHARED_EXPORT QStackedWidgetEventFilter : public QStackedWidgetPreviewEventFilter
71{
72 Q_OBJECT
73public:
74 explicit QStackedWidgetEventFilter(QStackedWidget *parent);
75
76 // Install helper on QStackedWidget
77 static void install(QStackedWidget *stackedWidget);
78 static QStackedWidgetEventFilter *eventFilterOf(const QStackedWidget *stackedWidget);
79 // Convenience to add a menu on a tackedWidget
80 static QMenu *addStackedWidgetContextMenuActions(const QStackedWidget *stackedWidget, QMenu *popup);
81
82 // Add context menu and return page submenu or 0.
83 QMenu *addContextMenuActions(QMenu *popup);
84
85private slots:
86 void removeCurrentPage();
87 void addPage();
88 void addPageAfter();
89 void changeOrder();
90
91protected:
92 void gotoPage(int page) override;
93
94private:
95 QAction *m_actionPreviousPage;
96 QAction *m_actionNextPage;
97 QAction *m_actionDeletePage;
98 QAction *m_actionInsertPage;
99 QAction *m_actionInsertPageAfter;
100 QAction *m_actionChangePageOrder;
101 qdesigner_internal::PromotionTaskMenu* m_pagePromotionTaskMenu;
102};
103
104// PropertySheet to handle the "currentPageName" property
105class QDESIGNER_SHARED_EXPORT QStackedWidgetPropertySheet : public QDesignerPropertySheet {
106public:
107 explicit QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent = nullptr);
108
109 void setProperty(int index, const QVariant &value) override;
110 QVariant property(int index) const override;
111 bool reset(int index) override;
112 bool isEnabled(int index) const override;
113
114 // Check whether the property is to be saved. Returns false for the page
115 // properties (as the property sheet has no concept of 'stored')
116 static bool checkProperty(const QString &propertyName);
117
118private:
119 QStackedWidget *m_stackedWidget;
120};
121
122using QStackedWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QStackedWidget, QStackedWidgetPropertySheet>;
123
124QT_END_NAMESPACE
125
126#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:421
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
QWidget * createPage(QWidget *parent) override
FormEditor(const QStringList &pluginPaths, QObject *parent=nullptr)
void setProperty(int index, const QVariant &value) override
static void markChangedStretchProperties(QDesignerFormEditorInterface *core, QLayout *lt, const DomLayout *domLayout)
static void stretchAttributesToDom(QDesignerFormEditorInterface *core, QLayout *lt, DomLayout *domLayout)
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.
#define QDESIGNER_SHARED_EXPORT