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
doc_src_designer-manual.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
// Qt-Security score:significant reason:default
4
5
//! [1]
6
#
include
<
QtUiTools
>
7
//! [1]
8
9
10
//! [2]
11
void
on_<object name>_<signal name>(<signal parameters>);
12
//! [2]
13
14
15
//! [7]
16
class
MyExtension:
public
QObject,
17
public
QDesignerContainerExtension
18
{
19
Q_OBJECT
20
Q_INTERFACE(QDesignerContainerExtension)
21
22
...
23
}
24
//! [7]
25
26
27
//! [8]
28
QObject *ANewExtensionFactory::createExtension(QObject *object,
29
const
QString &iid, QObject *parent)
const
30
{
31
if
(iid != Q_TYPEID(QDesignerContainerExtension))
32
return
0;
33
34
if
(MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
35
(object))
36
return
new
MyContainerExtension(widget, parent);
37
38
return
0;
39
}
40
//! [8]
41
42
43
//! [9]
44
QObject *AGeneralExtensionFactory::createExtension(QObject *object,
45
const
QString &iid, QObject *parent)
const
46
{
47
MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
48
49
if
(widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
50
return
new
MyTaskMenuExtension(widget, parent);
51
52
}
else
if
(widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
53
return
new
MyContainerExtension(widget, parent);
54
55
}
else
{
56
return
0;
57
}
58
}
59
//! [9]
60
61
62
//! [10]
63
void
MyPlugin::initialize(QDesignerFormEditorInterface *formEditor)
64
{
65
if
(initialized)
66
return
;
67
68
QExtensionManager *manager = formEditor->extensionManager();
69
Q_ASSERT(manager != 0);
70
71
manager->registerExtensions(
new
MyExtensionFactory(manager),
72
Q_TYPEID(QDesignerTaskMenuExtension));
73
74
initialized =
true
;
75
}
76
//! [10]
qttools
src
designer
src
designer
doc
snippets
manual
doc_src_designer-manual.cpp
Generated on
for Qt by
1.18.0