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
membersheet.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 \class QDesignerMemberSheetExtension
6
7 \brief The QDesignerMemberSheetExtension class allows you to
8 manipulate a widget's member functions which is displayed when
9 configuring connections using \QD's mode for editing
10 signals and slots.
11
12 \inmodule QtDesigner
13
14 QDesignerMemberSheetExtension is a collection of functions that is
15 typically used to query a widget's member functions, and to
16 manipulate the member functions' appearance in \QD's signals and
17 slots editing mode. For example:
18
19 \snippet plugins/doc_src_qtdesigner.cpp 2
20
21 When implementing a custom widget plugin, a pointer to \QD's
22 current QDesignerFormEditorInterface object (\c formEditor in the
23 example above) is provided by the
24 QDesignerCustomWidgetInterface::initialize() function's parameter.
25
26 The member sheet (and any other extension), can be retrieved by
27 querying \QD's extension manager using the qt_extension()
28 function. When you want to release the extension, you only need to
29 delete the pointer.
30
31 All widgets have a default member sheet used in \QD's signals and
32 slots editing mode with the widget's member functions. But
33 QDesignerMemberSheetExtension also provides an interface for
34 creating custom member sheet extensions.
35
36 \warning \QD uses the QDesignerMemberSheetExtension to facilitate
37 the signal and slot editing mode. Whenever a connection between
38 two widgets is requested, \QD will query for the widgets' member
39 sheet extensions. If a widget has an implemented member sheet
40 extension, this extension will override the default member sheet.
41
42 To create a member sheet extension, your extension class must
43 inherit from both QObject and QDesignerMemberSheetExtension. Then,
44 since we are implementing an interface, we must ensure that it's
45 made known to the meta object system using the Q_INTERFACES()
46 macro:
47
48 \snippet plugins/doc_src_qtdesigner.cpp 3
49
50 This enables \QD to use qobject_cast() to query for
51 supported interfaces using nothing but a QObject pointer.
52
53 In \QD the extensions are not created until they are
54 required. For that reason, when implementing a member sheet
55 extension, you must also create a QExtensionFactory, i.e a class
56 that is able to make an instance of your extension, and register
57 it using \QD's \l {QExtensionManager}{extension manager}.
58
59 When a widget's member sheet extension is required, \QD's \l
60 {QExtensionManager}{extension manager} will run through all its
61 registered factories calling QExtensionFactory::createExtension()
62 for each until the first one that is able to create a member sheet
63 extension for that widget, is found. This factory will then make
64 an instance of the extension. If no such factory is found, \QD
65 will use the default member sheet.
66
67 There are four available types of extensions in \QD:
68 QDesignerContainerExtension, QDesignerMemberSheetExtension,
69 QDesignerPropertySheetExtension and
70 QDesignerTaskMenuExtension. \QD's behavior is the same whether the
71 requested extension is associated with a multi page container, a
72 member sheet, a property sheet or a task menu.
73
74 The QExtensionFactory class provides a standard extension
75 factory, and can also be used as an interface for custom
76 extension factories. You can either create a new
77 QExtensionFactory and reimplement the
78 QExtensionFactory::createExtension() function. For example:
79
80 \snippet plugins/doc_src_qtdesigner.cpp 4
81
82 Or you can use an existing factory, expanding the
83 QExtensionFactory::createExtension() function to make the factory
84 able to create a member sheet extension as well. For example:
85
86 \snippet plugins/doc_src_qtdesigner.cpp 5
87
88 For a complete example using an extension class, see \l
89 {taskmenuextension}{Task Menu Extension example}. The
90 example shows how to create a custom widget plugin for Qt
91 Designer, and how to use the QDesignerTaskMenuExtension class
92 to add custom items to \QD's task menu.
93
94 \sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
95 Extensions}
96*/
97
98/*!
99 \fn QDesignerMemberSheetExtension::~QDesignerMemberSheetExtension()
100
101 Destroys the member sheet extension.
102*/
103
104/*!
105 \fn int QDesignerMemberSheetExtension::count() const
106
107 Returns the extension's number of member functions.
108*/
109
110/*!
111 \fn int QDesignerMemberSheetExtension::indexOf(const QString &name) const
112
113 Returns the index of the member function specified by the given \a
114 name.
115
116 \sa memberName()
117*/
118
119/*!
120 \fn QString QDesignerMemberSheetExtension::memberName(int index) const
121
122 Returns the name of the member function with the given \a index.
123
124 \sa indexOf()
125*/
126
127/*!
128 \fn QString QDesignerMemberSheetExtension::memberGroup(int index) const
129
130 Returns the name of the member group specified for the function
131 with the given \a index.
132
133 \sa indexOf(), setMemberGroup()
134*/
135
136/*!
137 \fn void QDesignerMemberSheetExtension::setMemberGroup(int index, const QString &group)
138
139 Sets the member group of the member function with the given \a
140 index, to \a group.
141
142 \sa indexOf(), memberGroup()
143*/
144
145/*!
146 \fn bool QDesignerMemberSheetExtension::isVisible(int index) const
147
148 Returns true if the member function with the given \a index is
149 visible in \QD's signal and slot editor, otherwise false.
150
151 \sa indexOf(), setVisible()
152*/
153
154/*!
155 \fn void QDesignerMemberSheetExtension::setVisible(int index, bool visible)
156
157 If \a visible is true, the member function with the given \a index
158 is visible in \QD's signals and slots editing mode; otherwise the
159 member function is hidden.
160
161 \sa indexOf(), isVisible()
162*/
163
164/*!
165 \fn virtual bool QDesignerMemberSheetExtension::isSignal(int index) const
166
167 Returns true if the member function with the given \a index is a
168 signal, otherwise false.
169
170 \sa indexOf()
171*/
172
173/*!
174 \fn bool QDesignerMemberSheetExtension::isSlot(int index) const
175
176 Returns true if the member function with the given \a index is a
177 slot, otherwise false.
178
179 \sa indexOf()
180*/
181
182/*!
183 \fn bool QDesignerMemberSheetExtension::inheritedFromWidget(int index) const
184
185 Returns true if the member function with the given \a index is
186 inherited from QWidget, otherwise false.
187
188 \sa indexOf()
189*/
190
191/*!
192 \fn QString QDesignerMemberSheetExtension::declaredInClass(int index) const
193
194 Returns the name of the class in which the member function with
195 the given \a index is declared.
196
197 \sa indexOf()
198*/
199
200/*!
201 \fn QString QDesignerMemberSheetExtension::signature(int index) const
202
203 Returns the signature of the member function with the given \a
204 index.
205
206 \sa indexOf()
207*/
208
209/*!
210 \fn QList<QByteArray> QDesignerMemberSheetExtension::parameterTypes(int index) const
211
212 Returns the parameter types of the member function with the given
213 \a index, as a QByteArray list.
214
215 \sa indexOf(), parameterNames()
216*/
217
218/*!
219 \fn QList<QByteArray> QDesignerMemberSheetExtension::parameterNames(int index) const
220
221 Returns the parameter names of the member function with the given
222 \a index, as a QByteArray list.
223
224 \sa indexOf(), parameterTypes()
225*/