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_promotiondialog_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 PROMOTIONEDITORDIALOG_H
17#define PROMOTIONEDITORDIALOG_H
18
19#include <QtWidgets/qdialog.h>
20#include <QtWidgets/qgroupbox.h>
21
23
24class QDesignerFormEditorInterface;
25class QDesignerFormWindowInterface;
26class QDesignerPromotionInterface;
28
29class QTreeView;
30class QPushButton;
31class QItemSelection;
32class QDialogButtonBox;
33class QComboBox;
34class QLineEdit;
35class QCheckBox;
36
37namespace qdesigner_internal {
39 class PromotionModel;
40
41
42 // Panel for adding a new promoted class. Separate class for code cleanliness.
45 public:
47 int selectedBaseClass = -1,
48 QWidget *parent = nullptr);
49
50 QString promotedHeaderSuffix() const { return m_promotedHeaderSuffix; }
51 void setPromotedHeaderSuffix(const QString &s) { m_promotedHeaderSuffix = s; }
52
53 bool isPromotedHeaderLowerCase() const { return m_promotedHeaderLowerCase; }
54 void setPromotedHeaderLowerCase(bool l) { m_promotedHeaderLowerCase = l; }
55
56 signals:
58
59 public slots:
60 void grabFocus();
61 void chooseBaseClass(const QString &);
62 private slots:
63 void slotNameChanged(const QString &);
64 void slotIncludeFileChanged(const QString &);
65 void slotAdd();
66 void slotReset();
67
68 private:
69 PromotionParameters promotionParameters() const;
70 void enableButtons();
71
72 QString m_promotedHeaderSuffix;
73 bool m_promotedHeaderLowerCase = false;
74
75 QComboBox *m_baseClassCombo;
76 QLineEdit *m_classNameEdit;
77 QLineEdit *m_includeFileEdit;
78 QCheckBox *m_globalIncludeCheckBox;
79 QPushButton *m_addButton;
80 };
81
82 // Dialog for editing promoted classes.
85
86 public:
88
89 explicit QDesignerPromotionDialog(QDesignerFormEditorInterface *core,
90 QWidget *parent = nullptr,
91 const QString &promotableWidgetClassName = QString(),
92 QString *promoteTo = nullptr);
93 // Return an alphabetically ordered list of base class names for adding new classes.
94 static const QStringList &baseClassNames(const QDesignerPromotionInterface *promotion);
95
96 signals:
98 private slots:
99 void slotRemove();
100 void slotAcceptPromoteTo();
101 void slotSelectionChanged(const QItemSelection &, const QItemSelection &);
102 void slotNewPromotedClass(const PromotionParameters &, bool *ok);
103
104 void slotIncludeFileChanged(QDesignerWidgetDataBaseItemInterface *, const QString &includeFile);
105 void slotClassNameChanged(QDesignerWidgetDataBaseItemInterface *, const QString &newName);
106 void slotUpdateFromWidgetDatabase();
107 void slotTreeViewContextMenu(const QPoint &);
108 void slotEditSignalsSlots();
109
110 private:
111 QDialogButtonBox *createButtonBox();
112 void delayedUpdateFromWidgetDatabase();
113 // Return item at model index and a combination of flags or 0.
114 enum { Referenced = 1, CanPromote = 2 };
115 QDesignerWidgetDataBaseItemInterface *databaseItemAt(const QItemSelection &, unsigned &flags) const;
116 void displayError(const QString &message);
117
118 const Mode m_mode;
119 const QString m_promotableWidgetClassName;
120 QDesignerFormEditorInterface *m_core;
121 QString *m_promoteTo;
122 QDesignerPromotionInterface *m_promotion;
123 PromotionModel *m_model;
124 QTreeView *m_treeView;
125 QDialogButtonBox *m_buttonBox;
126 QPushButton *m_removeButton;
127 QString m_lastSelectedBaseClass;
128 };
129} // namespace qdesigner_internal
130
131QT_END_NAMESPACE
132
133#endif // PROMOTIONEDITORDIALOG_H
The QDesignerWidgetDataBaseItemInterface class provides an interface that is used to access individua...
friend class QWidget
Definition qpainter.h:432
static const QStringList & baseClassNames(const QDesignerPromotionInterface *promotion)
QDesignerPromotionDialog(QDesignerFormEditorInterface *core, QWidget *parent=nullptr, const QString &promotableWidgetClassName=QString(), QString *promoteTo=nullptr)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QT_BEGIN_NAMESPACE QAction * separatorAction(QObject *parent)
static QDesignerLanguageExtension * languageExtension(QDesignerFormEditorInterface *core)