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