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
designer-custom-widgets.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtdesigner-components.html
6
\title Creating and Using Components for Qt Widgets Designer
7
\brief How to create and use custom widget plugins.
8
\ingroup best-practices
9
10
\section1 Creating Custom Widget Plugins
11
12
When implementing a custom widget plugin for \QD, you must
13
subclass QDesignerCustomWidgetInterface to expose your custom
14
widget to \QD. A single custom widget plugin is built as a
15
separate library. If you want to include several custom widget
16
plugins in the same library, you must in addition subclass
17
QDesignerCustomWidgetCollectionInterface.
18
19
To provide your custom widget plugin with the expected behavior
20
and functionality within \QD's workspace you can subclass the
21
associated extension classes:
22
23
The QDesignerContainerExtension class allows you to add pages to a
24
custom multi-page container. The QDesignerTaskMenuExtension class
25
allows you to add custom menu entries to \QD's task menu. The
26
QDesignerMemberSheetExtension class allows you to manipulate a
27
widget's member functions which is displayed when configuring
28
connections using \QD's mode for editing signals and slots. And
29
finally, the QDesignerPropertySheetExtension class allows you to
30
manipulate a widget's properties which is displayed in \QD's
31
property editor.
32
33
\image qtdesignerextensions.png {Diagram showing relation between
34
\QD components}
35
36
In \QD the extensions are not created until they are required. For
37
that reason, when implementing extensions, you must also subclass
38
QExtensionFactory, i.e create a class that is able to make
39
instances of your extensions. In addition, you must make \QD's
40
extension manager register your factory; the extension manager
41
controls the construction of extensions as they are required, and
42
you can access it through QDesignerFormEditorInterface and
43
QExtensionManager.
44
45
For a complete example creating a custom widget plugin with an
46
extension, see the \l {taskmenuextension}{Task Menu
47
Extension} or \l {containerextension}{Container
48
Extension} examples.
49
50
\section1 Retrieving Access to \QD Components
51
52
The purpose of the classes mentioned in this section is to provide
53
access to \QD's components, managers and workspace, and they are
54
not intended to be instantiated directly.
55
56
\QD is composed by several components. It has an action editor, a
57
property editor, widget box and object inspector which you can
58
view in its workspace.
59
60
\image qtdesignerscreenshot.png {Screenshot showing the UI of the
61
\QD editor}
62
63
\QD also has an object that works behind the scene; it contains
64
the logic that integrates all of \QD's components into a coherent
65
application. You can access this object, using the
66
QDesignerFormEditorInterface, to retrieve interfaces to \QD's
67
components:
68
69
\list
70
\li QDesignerActionEditorInterface
71
\li QDesignerObjectInspectorInterface
72
\li QDesignerPropertyEditorInterface
73
\li QDesignerWidgetBoxInterface
74
\endlist
75
76
In addition, you can use QDesignerFormEditorInterface to retrieve
77
interfaces to \QD's extension manager (QExtensionManager) and form
78
window manager (QDesignerFormWindowManagerInterface). The
79
extension manager controls the construction of extensions as they
80
are required, while the form window manager controls the form
81
windows appearing in \QD's workspace.
82
83
Once you have an interface to \QD's form window manager
84
(QDesignerFormWindowManagerInterface), you also have access to all
85
the form windows currently appearing in \QD's workspace: The
86
QDesignerFormWindowInterface class allows you to query and
87
manipulate the form windows, and it provides an interface to the
88
form windows' cursors. QDesignerFormWindowCursorInterface is a
89
convenience class allowing you to query and modify a given form
90
window's widget selection, and in addition modify the properties
91
of all the form's widgets.
92
93
\section1 Creating User Interfaces at Run-Time
94
95
The \c QtDesigner module contains the QFormBuilder class that
96
provides a mechanism for dynamically creating user interfaces at
97
run-time, based on UI files created with \QD. This class is
98
typically used by custom components and applications that embed
99
\QD. Standalone applications that need to dynamically generate
100
user interfaces at run-time use the QUiLoader class, found in
101
the QtUiTools module.
102
103
For a complete example using QUiLoader, see
104
the \l {calculatorbuilder}{Calculator Builder example}.
105
106
\sa {Qt Widgets Designer Manual}, {Qt UI Tools}
107
*/
qttools
src
designer
src
designer
doc
src
designer-custom-widgets.qdoc
Generated on
for Qt by
1.14.0