Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
abstractformeditor.cpp
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
#
include
"abstractformeditor.h"
6
#
include
"abstractdialoggui_p.h"
7
#
include
"abstractintrospection_p.h"
8
9
#
include
<
QtDesigner
/
abstractoptionspage
.
h
>
10
#
include
<
QtDesigner
/
abstractsettings
.
h
>
11
#
include
<
QtDesigner
/
abstractpropertyeditor
.
h
>
12
#
include
<
QtDesigner
/
abstractformwindowmanager
.
h
>
13
#
include
<
QtDesigner
/
qextensionmanager
.
h
>
14
#
include
<
QtDesigner
/
abstractmetadatabase
.
h
>
15
#
include
<
QtDesigner
/
abstractwidgetdatabase
.
h
>
16
#
include
<
QtDesigner
/
abstractwidgetfactory
.
h
>
17
#
include
<
QtDesigner
/
abstractobjectinspector
.
h
>
18
#
include
<
QtDesigner
/
abstractintegration
.
h
>
19
#
include
<
QtDesigner
/
abstractactioneditor
.
h
>
20
#
include
<
QtDesigner
/
abstractwidgetbox
.
h
>
21
22
#
include
<
actioneditor_p
.
h
>
23
#
include
<
pluginmanager_p
.
h
>
24
#
include
<
qtresourcemodel_p
.
h
>
25
#
include
<
qtgradientmanager_p
.
h
>
26
#
include
<
widgetfactory_p
.
h
>
27
#
include
<
shared_settings_p
.
h
>
28
#
include
<
formwindowbase_p
.
h
>
29
#
include
<
grid_p
.
h
>
30
#
include
<
iconloader_p
.
h
>
31
#
include
<
QtDesigner
/
abstractpromotioninterface
.
h
>
32
33
#
include
<
QtGui
/
qicon
.
h
>
34
35
// Must be done outside of the Qt namespace
36
static
void
initResources
()
37
{
38
Q_INIT_RESOURCE(shared);
39
Q_INIT_RESOURCE(ClamshellPhone);
40
Q_INIT_RESOURCE(PortableMedia);
41
Q_INIT_RESOURCE(S60_nHD_Touchscreen);
42
Q_INIT_RESOURCE(S60_QVGA_Candybar);
43
Q_INIT_RESOURCE(SmartPhone2);
44
Q_INIT_RESOURCE(SmartPhone);
45
Q_INIT_RESOURCE(SmartPhoneWithButtons);
46
Q_INIT_RESOURCE(TouchscreenPhone);
47
}
48
49
QT_BEGIN_NAMESPACE
50
51
using
namespace
Qt::StringLiterals;
52
53
class
QDesignerFormEditorInterfacePrivate
{
54
public
:
55
QDesignerFormEditorInterfacePrivate
();
56
~
QDesignerFormEditorInterfacePrivate
();
57
58
59
QPointer
<
QWidget
>
m_topLevel
;
60
QPointer
<
QDesignerWidgetBoxInterface
>
m_widgetBox
;
61
QPointer
<
QDesignerPropertyEditorInterface
>
m_propertyEditor
;
62
QPointer
<
QDesignerFormWindowManagerInterface
>
m_formWindowManager
;
63
QPointer
<
QExtensionManager
>
m_extensionManager
;
64
QPointer
<
QDesignerMetaDataBaseInterface
>
m_metaDataBase
;
65
QPointer
<
QDesignerWidgetDataBaseInterface
>
m_widgetDataBase
;
66
QPointer
<
QDesignerWidgetFactoryInterface
>
m_widgetFactory
;
67
QPointer
<
QDesignerObjectInspectorInterface
>
m_objectInspector
;
68
QPointer
<
QDesignerIntegrationInterface
>
m_integration
;
69
QPointer
<
QDesignerActionEditorInterface
>
m_actionEditor
;
70
QDesignerSettingsInterface *
m_settingsManager
=
nullptr
;
71
QDesignerPluginManager *
m_pluginManager
=
nullptr
;
72
QDesignerPromotionInterface *
m_promotion
=
nullptr
;
73
QDesignerIntrospectionInterface *
m_introspection
=
nullptr
;
74
QDesignerDialogGuiInterface *
m_dialogGui
=
nullptr
;
75
QPointer
<
QtResourceModel
>
m_resourceModel
;
76
QPointer
<
QtGradientManager
>
m_gradientManager
;
// instantiated and deleted by designer_integration
77
QList
<
QDesignerOptionsPageInterface
*>
m_optionsPages
;
78
};
79
80
QDesignerFormEditorInterfacePrivate
::
QDesignerFormEditorInterfacePrivate
() =
default
;
81
82
QDesignerFormEditorInterfacePrivate
::~
QDesignerFormEditorInterfacePrivate
()
83
{
84
delete
m_settingsManager
;
85
delete
m_formWindowManager;
86
delete
m_promotion
;
87
delete
m_introspection
;
88
delete
m_dialogGui
;
89
delete
m_resourceModel;
90
qDeleteAll(m_optionsPages);
91
}
92
93
/*!
94
\class QDesignerFormEditorInterface
95
96
\brief The QDesignerFormEditorInterface class allows you to access
97
Qt Widgets Designer's various components.
98
99
\inmodule QtDesigner
100
101
\QD's current QDesignerFormEditorInterface object holds
102
information about all \QD's components: The action editor, the
103
object inspector, the property editor, the widget box, and the
104
extension and form window managers. QDesignerFormEditorInterface
105
contains a collection of functions that provides interfaces to all
106
these components. They are typically used to query (and
107
manipulate) the respective component. For example:
108
109
\snippet lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp 0
110
111
QDesignerFormEditorInterface is not intended to be instantiated
112
directly. A pointer to \QD's current QDesignerFormEditorInterface
113
object (\c formEditor in the example above) is provided by the
114
QDesignerCustomWidgetInterface::initialize() function's
115
parameter. When implementing a custom widget plugin, you must
116
subclass the QDesignerCustomWidgetInterface to expose your plugin
117
to \QD.
118
119
QDesignerFormEditorInterface also provides functions that can set
120
the action editor, property editor, object inspector and widget
121
box. These are only useful if you want to provide your own custom
122
components.
123
124
If designer is embedded in another program, one could to provide its
125
own settings manager. The manager is used by the components of \QD
126
to store/retrieve persistent configuration settings. The default
127
manager uses QSettings as the backend.
128
129
Finally, QDesignerFormEditorInterface provides the topLevel()
130
function that returns \QD's top-level widget.
131
132
\sa QDesignerCustomWidgetInterface
133
*/
134
135
/*!
136
Constructs a QDesignerFormEditorInterface object with the given \a
137
parent.
138
*/
139
140
QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent)
141
: QObject(parent),
142
d(
new
QDesignerFormEditorInterfacePrivate())
143
{
144
initResources();
145
}
146
147
/*!
148
Destroys the QDesignerFormEditorInterface object.
149
*/
150
QDesignerFormEditorInterface::~QDesignerFormEditorInterface() =
default
;
151
152
/*!
153
Returns an interface to \QD's widget box.
154
155
\sa setWidgetBox()
156
*/
157
QDesignerWidgetBoxInterface *QDesignerFormEditorInterface::widgetBox()
const
158
{
159
return
d->m_widgetBox;
160
}
161
162
/*!
163
Sets \QD's widget box to be the specified \a widgetBox.
164
165
\sa widgetBox()
166
*/
167
void
QDesignerFormEditorInterface::setWidgetBox(QDesignerWidgetBoxInterface *widgetBox)
168
{
169
d->m_widgetBox = widgetBox;
170
}
171
172
/*!
173
Returns an interface to \QD's property editor.
174
175
\sa setPropertyEditor()
176
*/
177
QDesignerPropertyEditorInterface *QDesignerFormEditorInterface::propertyEditor()
const
178
{
179
return
d->m_propertyEditor;
180
}
181
182
/*!
183
Sets \QD's property editor to be the specified \a propertyEditor.
184
185
\sa propertyEditor()
186
*/
187
void
QDesignerFormEditorInterface::setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor)
188
{
189
d->m_propertyEditor = propertyEditor;
190
}
191
192
/*!
193
Returns an interface to \QD's action editor.
194
195
\sa setActionEditor()
196
*/
197
QDesignerActionEditorInterface *QDesignerFormEditorInterface::actionEditor()
const
198
{
199
return
d->m_actionEditor;
200
}
201
202
/*!
203
Sets \QD's action editor to be the specified \a actionEditor.
204
205
\sa actionEditor()
206
*/
207
void
QDesignerFormEditorInterface::setActionEditor(QDesignerActionEditorInterface *actionEditor)
208
{
209
d->m_actionEditor = actionEditor;
210
}
211
212
/*!
213
Returns \QD's top-level widget.
214
*/
215
QWidget *QDesignerFormEditorInterface::topLevel()
const
216
{
217
return
d->m_topLevel;
218
}
219
220
/*!
221
\internal
222
*/
223
void
QDesignerFormEditorInterface::setTopLevel(QWidget *topLevel)
224
{
225
d->m_topLevel = topLevel;
226
}
227
228
/*!
229
Returns an interface to \QD's form window manager.
230
*/
231
QDesignerFormWindowManagerInterface *QDesignerFormEditorInterface::formWindowManager()
const
232
{
233
return
d->m_formWindowManager;
234
}
235
236
/*!
237
\internal
238
*/
239
void
QDesignerFormEditorInterface::setFormManager(QDesignerFormWindowManagerInterface *formWindowManager)
240
{
241
d->m_formWindowManager = formWindowManager;
242
}
243
244
/*!
245
Returns an interface to \QD's extension manager.
246
*/
247
QExtensionManager *QDesignerFormEditorInterface::extensionManager()
const
248
{
249
return
d->m_extensionManager;
250
}
251
252
/*!
253
\internal
254
*/
255
void
QDesignerFormEditorInterface::setExtensionManager(QExtensionManager *extensionManager)
256
{
257
d->m_extensionManager = extensionManager;
258
}
259
260
/*!
261
\internal
262
263
Returns an interface to the meta database used by the form editor.
264
*/
265
QDesignerMetaDataBaseInterface *QDesignerFormEditorInterface::metaDataBase()
const
266
{
267
return
d->m_metaDataBase;
268
}
269
270
/*!
271
\internal
272
*/
273
void
QDesignerFormEditorInterface::setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase)
274
{
275
d->m_metaDataBase = metaDataBase;
276
}
277
278
/*!
279
\internal
280
281
Returns an interface to the widget database used by the form editor.
282
*/
283
QDesignerWidgetDataBaseInterface *QDesignerFormEditorInterface::widgetDataBase()
const
284
{
285
return
d->m_widgetDataBase;
286
}
287
288
/*!
289
\internal
290
*/
291
void
QDesignerFormEditorInterface::setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase)
292
{
293
d->m_widgetDataBase = widgetDataBase;
294
}
295
296
/*!
297
\internal
298
299
Returns an interface to the designer promotion handler.
300
*/
301
302
QDesignerPromotionInterface *QDesignerFormEditorInterface::promotion()
const
303
{
304
return
d->m_promotion;
305
}
306
307
/*!
308
\internal
309
310
Sets the designer promotion handler.
311
*/
312
313
void
QDesignerFormEditorInterface::setPromotion(QDesignerPromotionInterface *promotion)
314
{
315
delete
d->m_promotion;
316
d->m_promotion = promotion;
317
}
318
319
/*!
320
\internal
321
322
Returns an interface to the widget factory used by the form editor
323
to create widgets for the form.
324
*/
325
QDesignerWidgetFactoryInterface *QDesignerFormEditorInterface::widgetFactory()
const
326
{
327
return
d->m_widgetFactory;
328
}
329
330
/*!
331
\internal
332
*/
333
void
QDesignerFormEditorInterface::setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory)
334
{
335
d->m_widgetFactory = widgetFactory;
336
}
337
338
/*!
339
Returns an interface to \QD's object inspector.
340
*/
341
QDesignerObjectInspectorInterface *QDesignerFormEditorInterface::objectInspector()
const
342
{
343
return
d->m_objectInspector;
344
}
345
346
/*!
347
Sets \QD's object inspector to be the specified \a
348
objectInspector.
349
350
\sa objectInspector()
351
*/
352
void
QDesignerFormEditorInterface::setObjectInspector(QDesignerObjectInspectorInterface *objectInspector)
353
{
354
d->m_objectInspector = objectInspector;
355
}
356
357
/*!
358
\internal
359
360
Returns an interface to the integration.
361
*/
362
QDesignerIntegrationInterface *QDesignerFormEditorInterface::integration()
const
363
{
364
return
d->m_integration;
365
}
366
367
/*!
368
\internal
369
*/
370
void
QDesignerFormEditorInterface::setIntegration(QDesignerIntegrationInterface *integration)
371
{
372
d->m_integration = integration;
373
}
374
375
/*!
376
\internal
377
\since 4.5
378
Returns the list of options pages that allow the user to configure \QD components.
379
*/
380
QList<QDesignerOptionsPageInterface*> QDesignerFormEditorInterface::optionsPages()
const
381
{
382
return
d->m_optionsPages;
383
}
384
385
/*!
386
\internal
387
\since 4.5
388
Sets the list of options pages that allow the user to configure \QD components.
389
*/
390
void
QDesignerFormEditorInterface::setOptionsPages(
const
QList<QDesignerOptionsPageInterface*> &optionsPages)
391
{
392
d->m_optionsPages = optionsPages;
393
}
394
395
396
/*!
397
\internal
398
399
Returns the plugin manager used by the form editor.
400
*/
401
QDesignerPluginManager *QDesignerFormEditorInterface::pluginManager()
const
402
{
403
return
d->m_pluginManager;
404
}
405
406
/*!
407
\internal
408
409
Sets the plugin manager used by the form editor to the specified
410
\a pluginManager.
411
*/
412
void
QDesignerFormEditorInterface::setPluginManager(QDesignerPluginManager *pluginManager)
413
{
414
d->m_pluginManager = pluginManager;
415
}
416
417
/*!
418
\internal
419
\since 4.4
420
Returns the resource model used by the form editor.
421
*/
422
QtResourceModel *QDesignerFormEditorInterface::resourceModel()
const
423
{
424
return
d->m_resourceModel;
425
}
426
427
/*!
428
\internal
429
430
Sets the resource model used by the form editor to the specified
431
\a resourceModel.
432
*/
433
void
QDesignerFormEditorInterface::setResourceModel(QtResourceModel *resourceModel)
434
{
435
d->m_resourceModel = resourceModel;
436
}
437
438
/*!
439
\internal
440
\since 4.4
441
Returns the gradient manager used by the style sheet editor.
442
*/
443
QtGradientManager *QDesignerFormEditorInterface::gradientManager()
const
444
{
445
return
d->m_gradientManager;
446
}
447
448
/*!
449
\internal
450
451
Sets the gradient manager used by the style sheet editor to the specified
452
\a gradientManager.
453
*/
454
void
QDesignerFormEditorInterface::setGradientManager(QtGradientManager *gradientManager)
455
{
456
d->m_gradientManager = gradientManager;
457
}
458
459
/*!
460
\internal
461
\since 4.5
462
Returns the settings manager used by the components to store persistent settings.
463
*/
464
QDesignerSettingsInterface *QDesignerFormEditorInterface::settingsManager()
const
465
{
466
return
d->m_settingsManager;
467
}
468
469
/*!
470
\internal
471
\since 4.5
472
Sets the settings manager used to store/retrieve the persistent settings of the components.
473
*/
474
void
QDesignerFormEditorInterface::setSettingsManager(QDesignerSettingsInterface *settingsManager)
475
{
476
if
(d->m_settingsManager)
477
delete
d->m_settingsManager;
478
d->m_settingsManager = settingsManager;
479
480
// This is a (hopefully) safe place to perform settings-dependent
481
// initializations.
482
const
qdesigner_internal::QDesignerSharedSettings settings(
this
);
483
qdesigner_internal::FormWindowBase::setDefaultDesignerGrid(settings.defaultGrid());
484
qdesigner_internal::ActionEditor::setObjectNamingMode(settings.objectNamingMode());
485
}
486
487
/*!
488
\internal
489
\since 4.4
490
Returns the introspection used by the form editor.
491
*/
492
QDesignerIntrospectionInterface *QDesignerFormEditorInterface::introspection()
const
493
{
494
return
d->m_introspection;
495
}
496
497
/*!
498
\internal
499
\since 4.4
500
501
Sets the introspection used by the form editor to the specified \a introspection.
502
*/
503
void
QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterface *introspection)
504
{
505
delete
d->m_introspection;
506
d->m_introspection = introspection;
507
}
508
509
/*!
510
\internal
511
512
Returns the path to the resources used by the form editor.
513
*/
514
QString QDesignerFormEditorInterface::resourceLocation()
const
515
{
516
#
ifdef
Q_OS_MACOS
517
return
u":/qt-project.org/formeditor/images/mac"_s;
518
#
else
519
return
u":/qt-project.org/formeditor/images/win"_s;
520
#
endif
521
}
522
523
/*!
524
\internal
525
526
Returns the dialog GUI used by the form editor.
527
*/
528
529
QDesignerDialogGuiInterface *QDesignerFormEditorInterface::dialogGui()
const
530
{
531
return
d->m_dialogGui;
532
}
533
534
/*!
535
\internal
536
537
Sets the dialog GUI used by the form editor to the specified \a dialogGui.
538
*/
539
540
void
QDesignerFormEditorInterface::setDialogGui(QDesignerDialogGuiInterface *dialogGui)
541
{
542
delete
d->m_dialogGui;
543
d->m_dialogGui = dialogGui;
544
}
545
546
/*!
547
\internal
548
549
\since 5.0
550
551
Returns the plugin instances of QDesignerPluginManager.
552
*/
553
554
QObjectList QDesignerFormEditorInterface::pluginInstances()
const
555
{
556
return
d->m_pluginManager->instances();
557
}
558
559
/*!
560
\internal
561
562
\since 5.0
563
564
Return icons for actions of \QD.
565
*/
566
567
QIcon QDesignerFormEditorInterface::createIcon(
const
QString &name)
568
{
569
return
qdesigner_internal::createIconSet(name);
570
}
571
572
QT_END_NAMESPACE
initResources
static void initResources()
Definition
abstractformeditor.cpp:36
QDesignerFormEditorInterfacePrivate
Definition
abstractformeditor.cpp:53
QDesignerFormEditorInterfacePrivate::m_optionsPages
QList< QDesignerOptionsPageInterface * > m_optionsPages
Definition
abstractformeditor.cpp:77
QDesignerFormEditorInterfacePrivate::m_gradientManager
QPointer< QtGradientManager > m_gradientManager
Definition
abstractformeditor.cpp:76
QDesignerFormEditorInterfacePrivate::m_resourceModel
QPointer< QtResourceModel > m_resourceModel
Definition
abstractformeditor.cpp:75
QDesignerFormEditorInterfacePrivate::m_dialogGui
QDesignerDialogGuiInterface * m_dialogGui
Definition
abstractformeditor.cpp:74
QDesignerFormEditorInterfacePrivate::m_formWindowManager
QPointer< QDesignerFormWindowManagerInterface > m_formWindowManager
Definition
abstractformeditor.cpp:62
QDesignerFormEditorInterfacePrivate::m_objectInspector
QPointer< QDesignerObjectInspectorInterface > m_objectInspector
Definition
abstractformeditor.cpp:67
QDesignerFormEditorInterfacePrivate::m_topLevel
QPointer< QWidget > m_topLevel
Definition
abstractformeditor.cpp:59
QDesignerFormEditorInterfacePrivate::m_widgetFactory
QPointer< QDesignerWidgetFactoryInterface > m_widgetFactory
Definition
abstractformeditor.cpp:66
QDesignerFormEditorInterfacePrivate::m_introspection
QDesignerIntrospectionInterface * m_introspection
Definition
abstractformeditor.cpp:73
QDesignerFormEditorInterfacePrivate::m_widgetBox
QPointer< QDesignerWidgetBoxInterface > m_widgetBox
Definition
abstractformeditor.cpp:60
QDesignerFormEditorInterfacePrivate::m_metaDataBase
QPointer< QDesignerMetaDataBaseInterface > m_metaDataBase
Definition
abstractformeditor.cpp:64
QDesignerFormEditorInterfacePrivate::m_settingsManager
QDesignerSettingsInterface * m_settingsManager
Definition
abstractformeditor.cpp:70
QDesignerFormEditorInterfacePrivate::m_pluginManager
QDesignerPluginManager * m_pluginManager
Definition
abstractformeditor.cpp:71
QDesignerFormEditorInterfacePrivate::m_integration
QPointer< QDesignerIntegrationInterface > m_integration
Definition
abstractformeditor.cpp:68
QDesignerFormEditorInterfacePrivate::m_actionEditor
QPointer< QDesignerActionEditorInterface > m_actionEditor
Definition
abstractformeditor.cpp:69
QDesignerFormEditorInterfacePrivate::m_propertyEditor
QPointer< QDesignerPropertyEditorInterface > m_propertyEditor
Definition
abstractformeditor.cpp:61
QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate
~QDesignerFormEditorInterfacePrivate()
Definition
abstractformeditor.cpp:82
QDesignerFormEditorInterfacePrivate::QDesignerFormEditorInterfacePrivate
QDesignerFormEditorInterfacePrivate()
QDesignerFormEditorInterfacePrivate::m_promotion
QDesignerPromotionInterface * m_promotion
Definition
abstractformeditor.cpp:72
QDesignerFormEditorInterfacePrivate::m_widgetDataBase
QPointer< QDesignerWidgetDataBaseInterface > m_widgetDataBase
Definition
abstractformeditor.cpp:65
QDesignerFormEditorInterfacePrivate::m_extensionManager
QPointer< QExtensionManager > m_extensionManager
Definition
abstractformeditor.cpp:63
qttools
src
designer
src
lib
sdk
abstractformeditor.cpp
Generated on
for Qt by
1.18.0