blob: cdfd07648f8d393c11da2f1d42d1fa3392c86683 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//! [0]
QObject *ANewExtensionFactory::createExtension(QObject *object,
const QString &iid, QObject *parent) const
{
if (iid != Q_TYPEID(QDesignerContainerExtension))
return 0;
if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
(object))
return new MyContainerExtension(widget, parent);
return 0;
}
//! [0]
//! [1]
QObject *AGeneralExtensionFactory::createExtension(QObject *object,
const QString &iid, QObject *parent) const
{
MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
return new MyTaskMenuExtension(widget, parent);
} else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
return new MyContainerExtension(widget, parent);
} else {
return 0;
}
}
//! [1]
|