1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | // |
30 | // W A R N I N G |
31 | // ------------- |
32 | // |
33 | // This file is not part of the Qt API. It exists for the convenience |
34 | // of Qt Designer. This header |
35 | // file may change from version to version without notice, or even be removed. |
36 | // |
37 | // We mean it. |
38 | // |
39 | |
40 | #ifndef METADATABASE_H |
41 | #define METADATABASE_H |
42 | |
43 | #include "shared_global_p.h" |
44 | |
45 | #include <QtDesigner/abstractmetadatabase.h> |
46 | |
47 | #include <QtCore/qhash.h> |
48 | #include <QtCore/qstringlist.h> |
49 | #include <QtGui/qcursor.h> |
50 | |
51 | QT_BEGIN_NAMESPACE |
52 | |
53 | namespace qdesigner_internal { |
54 | |
55 | class QDESIGNER_SHARED_EXPORT MetaDataBaseItem: public QDesignerMetaDataBaseItemInterface |
56 | { |
57 | public: |
58 | explicit MetaDataBaseItem(QObject *object); |
59 | ~MetaDataBaseItem() override; |
60 | |
61 | QString name() const override; |
62 | void setName(const QString &name) override; |
63 | |
64 | QWidgetList tabOrder() const override; |
65 | void setTabOrder(const QWidgetList &tabOrder) override; |
66 | |
67 | bool enabled() const override; |
68 | void setEnabled(bool b) override; |
69 | |
70 | QString customClassName() const; |
71 | void setCustomClassName(const QString &customClassName); |
72 | |
73 | QStringList fakeSlots() const; |
74 | void setFakeSlots(const QStringList &); |
75 | |
76 | QStringList fakeSignals() const; |
77 | void setFakeSignals(const QStringList &); |
78 | |
79 | private: |
80 | QObject *m_object; |
81 | QWidgetList m_tabOrder; |
82 | bool m_enabled; |
83 | QString m_customClassName; |
84 | QStringList m_fakeSlots; |
85 | QStringList m_fakeSignals; |
86 | }; |
87 | |
88 | class QDESIGNER_SHARED_EXPORT MetaDataBase: public QDesignerMetaDataBaseInterface |
89 | { |
90 | Q_OBJECT |
91 | public: |
92 | explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = nullptr); |
93 | ~MetaDataBase() override; |
94 | |
95 | QDesignerFormEditorInterface *core() const override; |
96 | |
97 | QDesignerMetaDataBaseItemInterface *item(QObject *object) const override { return metaDataBaseItem(object); } |
98 | virtual MetaDataBaseItem *metaDataBaseItem(QObject *object) const; |
99 | void add(QObject *object) override; |
100 | void remove(QObject *object) override; |
101 | |
102 | QObjectList objects() const override; |
103 | |
104 | private slots: |
105 | void slotDestroyed(QObject *object); |
106 | |
107 | private: |
108 | QDesignerFormEditorInterface *m_core; |
109 | typedef QHash<QObject *, MetaDataBaseItem*> ItemMap; |
110 | ItemMap m_items; |
111 | }; |
112 | |
113 | // promotion convenience |
114 | QDESIGNER_SHARED_EXPORT bool promoteWidget(QDesignerFormEditorInterface *core,QWidget *widget,const QString &customClassName); |
115 | QDESIGNER_SHARED_EXPORT void demoteWidget(QDesignerFormEditorInterface *core,QWidget *widget); |
116 | QDESIGNER_SHARED_EXPORT bool isPromoted(QDesignerFormEditorInterface *core, QWidget* w); |
117 | QDESIGNER_SHARED_EXPORT QString promotedCustomClassName(QDesignerFormEditorInterface *core, QWidget* w); |
118 | QDESIGNER_SHARED_EXPORT QString promotedExtends(QDesignerFormEditorInterface *core, QWidget* w); |
119 | |
120 | } // namespace qdesigner_internal |
121 | |
122 | QT_END_NAMESPACE |
123 | |
124 | #endif // METADATABASE_H |
125 | |