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