1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef CUSTOMWIDGET_H |
5 | #define CUSTOMWIDGET_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | #include <QtCore/qstring.h> |
9 | #include <QtGui/qicon.h> |
10 | |
11 | #if 0 |
12 | #pragma qt_deprecates(QtDesigner/customwidget.h) |
13 | #pragma qt_deprecates(QtDesigner/QDesignerCustomWidgetInterface) |
14 | #pragma qt_deprecates(QtDesigner/QDesignerCustomWidgetCollectionInterface) |
15 | #endif |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | class QWidget; |
20 | class QDesignerFormEditorInterface; |
21 | |
22 | class QDesignerCustomWidgetInterface |
23 | { |
24 | public: |
25 | virtual ~QDesignerCustomWidgetInterface() = default; // ### FIXME: weak vtable |
26 | |
27 | virtual QString name() const = 0; |
28 | virtual QString group() const = 0; |
29 | virtual QString toolTip() const = 0; |
30 | virtual QString whatsThis() const = 0; |
31 | virtual QString includeFile() const = 0; |
32 | virtual QIcon icon() const = 0; |
33 | |
34 | virtual bool isContainer() const = 0; |
35 | |
36 | virtual QWidget *createWidget(QWidget *parent) = 0; |
37 | |
38 | virtual bool isInitialized() const { return false; } |
39 | virtual void initialize(QDesignerFormEditorInterface *core) { Q_UNUSED(core); } |
40 | |
41 | virtual QString domXml() const |
42 | { |
43 | return QLatin1StringView("<widget class=\"%1\" name=\"%2\"/>" ) |
44 | .arg(args: name(), args: name().toLower()); |
45 | } |
46 | |
47 | virtual QString codeTemplate() const { return QString(); } |
48 | }; |
49 | |
50 | #define QDesignerCustomWidgetInterface_iid "org.qt-project.QDesignerCustomWidgetInterface" |
51 | |
52 | Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, QDesignerCustomWidgetInterface_iid) |
53 | |
54 | class QDesignerCustomWidgetCollectionInterface |
55 | { |
56 | public: |
57 | virtual ~QDesignerCustomWidgetCollectionInterface() = default; // ### FIXME: weak vtable |
58 | |
59 | virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0; |
60 | }; |
61 | |
62 | #define QDesignerCustomWidgetCollectionInterface_iid "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface" |
63 | |
64 | Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface, QDesignerCustomWidgetCollectionInterface_iid) |
65 | |
66 | QT_END_NAMESPACE |
67 | |
68 | #endif // CUSTOMWIDGET_H |
69 | |