|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Designer of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 // |
|
43 // W A R N I N G |
|
44 // ------------- |
|
45 // |
|
46 // This file is not part of the Qt API. It exists for the convenience |
|
47 // of Qt Designer. This header |
|
48 // file may change from version to version without notice, or even be removed. |
|
49 // |
|
50 // We mean it. |
|
51 // |
|
52 |
|
53 |
|
54 #ifndef WIDGETDATABASE_H |
|
55 #define WIDGETDATABASE_H |
|
56 |
|
57 #include "shared_global_p.h" |
|
58 |
|
59 #include <QtDesigner/QDesignerWidgetDataBaseInterface> |
|
60 |
|
61 #include <QtGui/QIcon> |
|
62 #include <QtCore/QString> |
|
63 #include <QtCore/QVariant> |
|
64 #include <QtCore/QPair> |
|
65 #include <QtCore/QStringList> |
|
66 |
|
67 QT_BEGIN_NAMESPACE |
|
68 |
|
69 class QObject; |
|
70 class QDesignerCustomWidgetInterface; |
|
71 |
|
72 namespace qdesigner_internal { |
|
73 |
|
74 class QDESIGNER_SHARED_EXPORT WidgetDataBaseItem: public QDesignerWidgetDataBaseItemInterface |
|
75 { |
|
76 public: |
|
77 WidgetDataBaseItem(const QString &name = QString(), |
|
78 const QString &group = QString()); |
|
79 |
|
80 QString name() const; |
|
81 void setName(const QString &name); |
|
82 |
|
83 QString group() const; |
|
84 void setGroup(const QString &group); |
|
85 |
|
86 QString toolTip() const; |
|
87 void setToolTip(const QString &toolTip); |
|
88 |
|
89 QString whatsThis() const; |
|
90 void setWhatsThis(const QString &whatsThis); |
|
91 |
|
92 QString includeFile() const; |
|
93 void setIncludeFile(const QString &includeFile); |
|
94 |
|
95 |
|
96 QIcon icon() const; |
|
97 void setIcon(const QIcon &icon); |
|
98 |
|
99 bool isCompat() const; |
|
100 void setCompat(bool compat); |
|
101 |
|
102 bool isContainer() const; |
|
103 void setContainer(bool b); |
|
104 |
|
105 bool isCustom() const; |
|
106 void setCustom(bool b); |
|
107 |
|
108 QString pluginPath() const; |
|
109 void setPluginPath(const QString &path); |
|
110 |
|
111 bool isPromoted() const; |
|
112 void setPromoted(bool b); |
|
113 |
|
114 QString extends() const; |
|
115 void setExtends(const QString &s); |
|
116 |
|
117 void setDefaultPropertyValues(const QList<QVariant> &list); |
|
118 QList<QVariant> defaultPropertyValues() const; |
|
119 |
|
120 static WidgetDataBaseItem *clone(const QDesignerWidgetDataBaseItemInterface *item); |
|
121 |
|
122 QStringList fakeSlots() const; |
|
123 void setFakeSlots(const QStringList &); |
|
124 |
|
125 QStringList fakeSignals() const; |
|
126 void setFakeSignals(const QStringList &); |
|
127 |
|
128 QString addPageMethod() const; |
|
129 void setAddPageMethod(const QString &m); |
|
130 |
|
131 private: |
|
132 QString m_name; |
|
133 QString m_group; |
|
134 QString m_toolTip; |
|
135 QString m_whatsThis; |
|
136 QString m_includeFile; |
|
137 QString m_pluginPath; |
|
138 QString m_extends; |
|
139 QString m_addPageMethod; |
|
140 QIcon m_icon; |
|
141 uint m_compat: 1; |
|
142 uint m_container: 1; |
|
143 uint m_form: 1; |
|
144 uint m_custom: 1; |
|
145 uint m_promoted: 1; |
|
146 QList<QVariant> m_defaultPropertyValues; |
|
147 QStringList m_fakeSlots; |
|
148 QStringList m_fakeSignals; |
|
149 }; |
|
150 |
|
151 enum IncludeType { IncludeLocal, IncludeGlobal }; |
|
152 |
|
153 typedef QPair<QString, IncludeType> IncludeSpecification; |
|
154 |
|
155 QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile); |
|
156 QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType); |
|
157 |
|
158 class QDESIGNER_SHARED_EXPORT WidgetDataBase: public QDesignerWidgetDataBaseInterface |
|
159 { |
|
160 Q_OBJECT |
|
161 public: |
|
162 WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); |
|
163 virtual ~WidgetDataBase(); |
|
164 |
|
165 virtual QDesignerFormEditorInterface *core() const; |
|
166 |
|
167 virtual int indexOfObject(QObject *o, bool resolveName = true) const; |
|
168 |
|
169 void remove(int index); |
|
170 |
|
171 |
|
172 void grabDefaultPropertyValues(); |
|
173 void grabStandardWidgetBoxIcons(); |
|
174 |
|
175 // Helpers for 'New Form' wizards in integrations. Obtain a list of suitable classes and generate XML for them. |
|
176 static QStringList formWidgetClasses(const QDesignerFormEditorInterface *core); |
|
177 static QStringList customFormWidgetClasses(const QDesignerFormEditorInterface *core); |
|
178 static QString formTemplate(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName); |
|
179 |
|
180 // Helpers for 'New Form' wizards: Set a fixed size on a XML form template |
|
181 static QString scaleFormTemplate(const QString &xml, const QSize &size, bool fixed); |
|
182 |
|
183 public slots: |
|
184 void loadPlugins(); |
|
185 |
|
186 private: |
|
187 QList<QVariant> defaultPropertyValues(const QString &name); |
|
188 |
|
189 QDesignerFormEditorInterface *m_core; |
|
190 }; |
|
191 |
|
192 QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface |
|
193 *appendDerived(QDesignerWidgetDataBaseInterface *db, |
|
194 const QString &className, |
|
195 const QString &group, |
|
196 const QString &baseClassName, |
|
197 const QString &includeFile, |
|
198 bool promoted, |
|
199 bool custom); |
|
200 |
|
201 typedef QList<QDesignerWidgetDataBaseItemInterface*> WidgetDataBaseItemList; |
|
202 |
|
203 QDESIGNER_SHARED_EXPORT WidgetDataBaseItemList |
|
204 promotionCandidates(const QDesignerWidgetDataBaseInterface *db, |
|
205 const QString &baseClassName); |
|
206 } // namespace qdesigner_internal |
|
207 |
|
208 QT_END_NAMESPACE |
|
209 |
|
210 #endif // WIDGETDATABASE_H |