1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
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 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | /*!
|
---|
43 | \class QDesignerMemberSheetExtension
|
---|
44 |
|
---|
45 | \brief The QDesignerMemberSheetExtension class allows you to
|
---|
46 | manipulate a widget's member functions which is displayed when
|
---|
47 | configuring connections using Qt Designer's mode for editing
|
---|
48 | signals and slots.
|
---|
49 |
|
---|
50 | \inmodule QtDesigner
|
---|
51 |
|
---|
52 | QDesignerMemberSheetExtension is a collection of functions that is
|
---|
53 | typically used to query a widget's member functions, and to
|
---|
54 | manipulate the member functions' appearance in \QD's signals and
|
---|
55 | slots editing mode. For example:
|
---|
56 |
|
---|
57 | \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 2
|
---|
58 |
|
---|
59 | When implementing a custom widget plugin, a pointer to \QD's
|
---|
60 | current QDesignerFormEditorInterface object (\c formEditor in the
|
---|
61 | example above) is provided by the
|
---|
62 | QDesignerCustomWidgetInterface::initialize() function's parameter.
|
---|
63 |
|
---|
64 | The member sheet (and any other extension), can be retrieved by
|
---|
65 | querying \QD's extension manager using the qt_extension()
|
---|
66 | function. When you want to release the extension, you only need to
|
---|
67 | delete the pointer.
|
---|
68 |
|
---|
69 | All widgets have a default member sheet used in \QD's signals and
|
---|
70 | slots editing mode with the widget's member functions. But
|
---|
71 | QDesignerMemberSheetExtension also provides an interface for
|
---|
72 | creating custom member sheet extensions.
|
---|
73 |
|
---|
74 | \warning \QD uses the QDesignerMemberSheetExtension to facilitate
|
---|
75 | the signal and slot editing mode. Whenever a connection between
|
---|
76 | two widgets is requested, \QD will query for the widgets' member
|
---|
77 | sheet extensions. If a widget has an implemented member sheet
|
---|
78 | extension, this extension will override the default member sheet.
|
---|
79 |
|
---|
80 | To create a member sheet extension, your extension class must
|
---|
81 | inherit from both QObject and QDesignerMemberSheetExtension. Then,
|
---|
82 | since we are implementing an interface, we must ensure that it's
|
---|
83 | made known to the meta object system using the Q_INTERFACES()
|
---|
84 | macro:
|
---|
85 |
|
---|
86 | \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 3
|
---|
87 |
|
---|
88 | This enables \QD to use qobject_cast() to query for
|
---|
89 | supported interfaces using nothing but a QObject pointer.
|
---|
90 |
|
---|
91 | In \QD the extensions are not created until they are
|
---|
92 | required. For that reason, when implementing a member sheet
|
---|
93 | extension, you must also create a QExtensionFactory, i.e a class
|
---|
94 | that is able to make an instance of your extension, and register
|
---|
95 | it using \QD's \l {QExtensionManager}{extension manager}.
|
---|
96 |
|
---|
97 | When a widget's member sheet extension is required, \QD's \l
|
---|
98 | {QExtensionManager}{extension manager} will run through all its
|
---|
99 | registered factories calling QExtensionFactory::createExtension()
|
---|
100 | for each until the first one that is able to create a member sheet
|
---|
101 | extension for that widget, is found. This factory will then make
|
---|
102 | an instance of the extension. If no such factory is found, \QD
|
---|
103 | will use the default member sheet.
|
---|
104 |
|
---|
105 | There are four available types of extensions in \QD:
|
---|
106 | QDesignerContainerExtension, QDesignerMemberSheetExtension,
|
---|
107 | QDesignerPropertySheetExtension and
|
---|
108 | QDesignerTaskMenuExtension. \QD's behavior is the same whether the
|
---|
109 | requested extension is associated with a multi page container, a
|
---|
110 | member sheet, a property sheet or a task menu.
|
---|
111 |
|
---|
112 | The QExtensionFactory class provides a standard extension
|
---|
113 | factory, and can also be used as an interface for custom
|
---|
114 | extension factories. You can either create a new
|
---|
115 | QExtensionFactory and reimplement the
|
---|
116 | QExtensionFactory::createExtension() function. For example:
|
---|
117 |
|
---|
118 | \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 4
|
---|
119 |
|
---|
120 | Or you can use an existing factory, expanding the
|
---|
121 | QExtensionFactory::createExtension() function to make the factory
|
---|
122 | able to create a member sheet extension as well. For example:
|
---|
123 |
|
---|
124 | \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 5
|
---|
125 |
|
---|
126 | For a complete example using an extension class, see \l
|
---|
127 | {designer/taskmenuextension}{Task Menu Extension example}. The
|
---|
128 | example shows how to create a custom widget plugin for Qt
|
---|
129 | Designer, and how to to use the QDesignerTaskMenuExtension class
|
---|
130 | to add custom items to \QD's task menu.
|
---|
131 |
|
---|
132 | \sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
|
---|
133 | Extensions}
|
---|
134 | */
|
---|
135 |
|
---|
136 | /*!
|
---|
137 | \fn QDesignerMemberSheetExtension::~QDesignerMemberSheetExtension()
|
---|
138 |
|
---|
139 | Destroys the member sheet extension.
|
---|
140 | */
|
---|
141 |
|
---|
142 | /*!
|
---|
143 | \fn int QDesignerMemberSheetExtension::count() const
|
---|
144 |
|
---|
145 | Returns the extension's number of member functions.
|
---|
146 | */
|
---|
147 |
|
---|
148 | /*!
|
---|
149 | \fn int QDesignerMemberSheetExtension::indexOf(const QString &name) const
|
---|
150 |
|
---|
151 | Returns the index of the member function specified by the given \a
|
---|
152 | name.
|
---|
153 |
|
---|
154 | \sa memberName()
|
---|
155 | */
|
---|
156 |
|
---|
157 | /*!
|
---|
158 | \fn QString QDesignerMemberSheetExtension::memberName(int index) const
|
---|
159 |
|
---|
160 | Returns the name of the member function with the given \a index.
|
---|
161 |
|
---|
162 | \sa indexOf()
|
---|
163 | */
|
---|
164 |
|
---|
165 | /*!
|
---|
166 | \fn QString QDesignerMemberSheetExtension::memberGroup(int index) const
|
---|
167 |
|
---|
168 | Returns the name of the member group specified for the function
|
---|
169 | with the given \a index.
|
---|
170 |
|
---|
171 | \sa indexOf(), setMemberGroup()
|
---|
172 | */
|
---|
173 |
|
---|
174 | /*!
|
---|
175 | \fn void QDesignerMemberSheetExtension::setMemberGroup(int index, const QString &group)
|
---|
176 |
|
---|
177 | Sets the member group of the member function with the given \a
|
---|
178 | index, to \a group.
|
---|
179 |
|
---|
180 | \sa indexOf(), memberGroup()
|
---|
181 | */
|
---|
182 |
|
---|
183 | /*!
|
---|
184 | \fn bool QDesignerMemberSheetExtension::isVisible(int index) const
|
---|
185 |
|
---|
186 | Returns true if the member function with the given \a index is
|
---|
187 | visible in \QD's signal and slot editor, otherwise false.
|
---|
188 |
|
---|
189 | \sa indexOf(), setVisible()
|
---|
190 | */
|
---|
191 |
|
---|
192 | /*!
|
---|
193 | \fn void QDesignerMemberSheetExtension::setVisible(int index, bool visible)
|
---|
194 |
|
---|
195 | If \a visible is true, the member function with the given \a index
|
---|
196 | is visible in \QD's signals and slots editing mode; otherwise the
|
---|
197 | member function is hidden.
|
---|
198 |
|
---|
199 | \sa indexOf(), isVisible()
|
---|
200 | */
|
---|
201 |
|
---|
202 | /*!
|
---|
203 | \fn virtual bool QDesignerMemberSheetExtension::isSignal(int index) const
|
---|
204 |
|
---|
205 | Returns true if the member function with the given \a index is a
|
---|
206 | signal, otherwise false.
|
---|
207 |
|
---|
208 | \sa indexOf()
|
---|
209 | */
|
---|
210 |
|
---|
211 | /*!
|
---|
212 | \fn bool QDesignerMemberSheetExtension::isSlot(int index) const
|
---|
213 |
|
---|
214 | Returns true if the member function with the given \a index is a
|
---|
215 | slot, otherwise false.
|
---|
216 |
|
---|
217 | \sa indexOf()
|
---|
218 | */
|
---|
219 |
|
---|
220 | /*!
|
---|
221 | \fn bool QDesignerMemberSheetExtension::inheritedFromWidget(int index) const
|
---|
222 |
|
---|
223 | Returns true if the member function with the given \a index is
|
---|
224 | inherited from QWidget, otherwise false.
|
---|
225 |
|
---|
226 | \sa indexOf()
|
---|
227 | */
|
---|
228 |
|
---|
229 | /*!
|
---|
230 | \fn QString QDesignerMemberSheetExtension::declaredInClass(int index) const
|
---|
231 |
|
---|
232 | Returns the name of the class in which the member function with
|
---|
233 | the given \a index is declared.
|
---|
234 |
|
---|
235 | \sa indexOf()
|
---|
236 | */
|
---|
237 |
|
---|
238 | /*!
|
---|
239 | \fn QString QDesignerMemberSheetExtension::signature(int index) const
|
---|
240 |
|
---|
241 | Returns the signature of the member function with the given \a
|
---|
242 | index.
|
---|
243 |
|
---|
244 | \sa indexOf()
|
---|
245 | */
|
---|
246 |
|
---|
247 | /*!
|
---|
248 | \fn QList<QByteArray> QDesignerMemberSheetExtension::parameterTypes(int index) const
|
---|
249 |
|
---|
250 | Returns the parameter types of the member function with the given
|
---|
251 | \a index, as a QByteArray list.
|
---|
252 |
|
---|
253 | \sa indexOf(), parameterNames()
|
---|
254 | */
|
---|
255 |
|
---|
256 | /*!
|
---|
257 | \fn QList<QByteArray> QDesignerMemberSheetExtension::parameterNames(int index) const
|
---|
258 |
|
---|
259 | Returns the parameter names of the member function with the given
|
---|
260 | \a index, as a QByteArray list.
|
---|
261 |
|
---|
262 | \sa indexOf(), parameterTypes()
|
---|
263 | */
|
---|