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