source: trunk/doc/src/howtos/qtdesigner.qdoc

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 5.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 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:FDL$
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 a
14** written agreement between you and Nokia.
15**
16** GNU Free Documentation License
17** Alternatively, this file may be used under the terms of the GNU Free
18** Documentation License version 1.3 as published by the Free Software
19** Foundation and appearing in the file included in the packaging of this
20** file.
21**
22** If you have questions regarding the use of this file, please contact
23** Nokia at [email protected].
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \page qtdesigner-components.html
30 \title Creating and Using Components for Qt Designer
31 \brief How to create and use custom widget plugins.
32 \ingroup best-practices
33
34 \tableofcontents
35
36 \section1 Creating Custom Widget Plugins
37
38 When implementing a custom widget plugin for \QD, you must
39 subclass QDesignerCustomWidgetInterface to expose your custom
40 widget to \QD. A single custom widget plugin is built as a
41 separate library. If you want to include several custom widget
42 plugins in the same library, you must in addition subclass
43 QDesignerCustomWidgetCollectionInterface.
44
45 To provide your custom widget plugin with the expected behavior
46 and functionality within \QD's workspace you can subclass the
47 associated extension classes:
48
49 The QDesignerContainerExtension class allows you to add pages to a
50 custom multi-page container. The QDesignerTaskMenuExtension class
51 allows you to add custom menu entries to \QD's task menu. The
52 QDesignerMemberSheetExtension class allows you to manipulate a
53 widget's member functions which is displayed when configuring
54 connections using \QD's mode for editing signals and slots. And
55 finally, the QDesignerPropertySheetExtension class allows you to
56 manipulate a widget's properties which is displayed in \QD's
57 property editor.
58
59 \image qtdesignerextensions.png
60
61 In \QD the extensions are not created until they are required. For
62 that reason, when implementing extensions, you must also subclass
63 QExtensionFactory, i.e create a class that is able to make
64 instances of your extensions. In addition, you must make \QD's
65 extension manager register your factory; the extension manager
66 controls the construction of extensions as they are required, and
67 you can access it through QDesignerFormEditorInterface and
68 QExtensionManager.
69
70 For a complete example creating a custom widget plugin with an
71 extension, see the \l {designer/taskmenuextension}{Task Menu
72 Extension} or \l {designer/containerextension}{Container
73 Extension} examples.
74
75 \section1 Retrieving Access to \QD Components
76
77 The purpose of the classes mentioned in this section is to provide
78 access to \QD's components, managers and workspace, and they are
79 not intended to be instantiated directly.
80
81 \QD is composed by several components. It has an action editor, a
82 property editor, widget box and object inspector which you can
83 view in its workspace.
84
85 \image qtdesignerscreenshot.png
86
87 \QD also has an object that works behind the scene; it contains
88 the logic that integrates all of \QD's components into a coherent
89 application. You can access this object, using the
90 QDesignerFormEditorInterface, to retrieve interfaces to \QD's
91 components:
92
93 \list
94 \o QDesignerActionEditorInterface
95 \o QDesignerObjectInspectorInterface
96 \o QDesignerPropertyEditorInterface
97 \o QDesignerWidgetBoxInterface
98 \endlist
99
100 In addition, you can use QDesignerFormEditorInterface to retrieve
101 interfaces to \QD's extension manager (QExtensionManager) and form
102 window manager (QDesignerFormWindowManagerInterface). The
103 extension manager controls the construction of extensions as they
104 are required, while the form window manager controls the form
105 windows appearing in \QD's workspace.
106
107 Once you have an interface to \QD's form window manager
108 (QDesignerFormWindowManagerInterface), you also have access to all
109 the form windows currently appearing in \QD's workspace: The
110 QDesignerFormWindowInterface class allows you to query and
111 manipulate the form windows, and it provides an interface to the
112 form windows' cursors. QDesignerFormWindowCursorInterface is a
113 convenience class allowing you to query and modify a given form
114 window's widget selection, and in addition modify the properties
115 of all the form's widgets.
116
117 \section1 Creating User Interfaces at Run-Time
118
119 The \c QtDesigner module contains the QFormBuilder class that
120 provides a mechanism for dynamically creating user interfaces at
121 run-time, based on UI files created with \QD. This class is
122 typically used by custom components and applications that embed
123 \QD. Standalone applications that need to dynamically generate
124 user interfaces at run-time use the QUiLoader class, found in
125 the QtUiTools module.
126
127 For a complete example using QUiLoader, see
128 the \l {designer/calculatorbuilder}{Calculator Builder example}.
129
130 \sa {Qt Designer Manual}, {QtUiTools Module}
131*/
Note: See TracBrowser for help on using the repository browser.