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_tabwidget_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_TABWIDGET_H
17#define QDESIGNER_TABWIDGET_H
18
22
23#include <QtCore/qhash.h>
24#include <QtCore/qpointer.h>
25#include <QtGui/qicon.h>
26
28
29class QDesignerFormWindowInterface;
30class QTabWidget;
31class QTabBar;
32class QMenu;
33class QAction;
34
35namespace qdesigner_internal {
36 class PromotionTaskMenu;
37}
38
40{
41 Q_OBJECT
42public:
43 explicit QTabWidgetEventFilter(QTabWidget *parent);
44 ~QTabWidgetEventFilter() override;
45
46 // Install helper on QTabWidget
47 static void install(QTabWidget *tabWidget);
48 static QTabWidgetEventFilter *eventFilterOf(const QTabWidget *tabWidget);
49 // Convenience to add a menu on a tackedWidget
50 static QMenu *addTabWidgetContextMenuActions(const QTabWidget *tabWidget, QMenu *popup);
51
52 // Add context menu and return page submenu or 0.
53 QMenu *addContextMenuActions(QMenu *popup);
54
55 bool eventFilter(QObject *o, QEvent *e) override;
56
57 QDesignerFormWindowInterface *formWindow() const;
58
59private slots:
60 void removeCurrentPage();
61 void addPage();
62 void addPageAfter();
63
64private:
65 int pageFromPosition(const QPoint &pos, QRect &rect) const;
66 QTabBar *tabBar() const;
67
68 QTabWidget *m_tabWidget;
69 mutable QPointer<QTabBar> m_cachedTabBar;
70 QPoint m_pressPoint;
71 QWidget *m_dropIndicator = nullptr;
72 int m_dragIndex = -1;
73 QWidget *m_dragPage = nullptr;
74 QString m_dragLabel;
75 QIcon m_dragIcon;
76 bool m_mousePressed = false;
77 QAction *m_actionDeletePage;
78 QAction *m_actionInsertPage;
79 QAction *m_actionInsertPageAfter;
80 qdesigner_internal::PromotionTaskMenu* m_pagePromotionTaskMenu;
81};
82
83// PropertySheet to handle the page properties
84class QDESIGNER_SHARED_EXPORT QTabWidgetPropertySheet : public QDesignerPropertySheet {
85public:
86 explicit QTabWidgetPropertySheet(QTabWidget *object, QObject *parent = nullptr);
87
88 void setProperty(int index, const QVariant &value) override;
89 QVariant property(int index) const override;
90 bool reset(int index) override;
91 bool isEnabled(int index) const override;
92
93 // Check whether the property is to be saved. Returns false for the page
94 // properties (as the property sheet has no concept of 'stored')
95 static bool checkProperty(const QString &propertyName);
96
97private:
98 enum TabWidgetProperty { PropertyCurrentTabText, PropertyCurrentTabName, PropertyCurrentTabIcon,
99 PropertyCurrentTabToolTip, PropertyCurrentTabWhatsThis, PropertyTabWidgetNone };
100
101 static TabWidgetProperty tabWidgetPropertyFromName(const QString &name);
102 QTabWidget *m_tabWidget;
103 struct PageData
104 {
105 qdesigner_internal::PropertySheetStringValue text;
106 qdesigner_internal::PropertySheetStringValue tooltip;
107 qdesigner_internal::PropertySheetStringValue whatsthis;
108 qdesigner_internal::PropertySheetIconValue icon;
109 };
110 QHash<QWidget *, PageData> m_pageToData;
111};
112
113using QTabWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QTabWidget, QTabWidgetPropertySheet>;
114
115QT_END_NAMESPACE
116
117#endif // QDESIGNER_TABWIDGET_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