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