1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef CUSTOMWIDGET_H |
30 | #define CUSTOMWIDGET_H |
31 | |
32 | #include <QtCore/qobject.h> |
33 | #include <QtCore/qstring.h> |
34 | #include <QtGui/qicon.h> |
35 | |
36 | QT_BEGIN_NAMESPACE |
37 | |
38 | class QWidget; |
39 | class QDesignerFormEditorInterface; |
40 | |
41 | class QDesignerCustomWidgetInterface |
42 | { |
43 | public: |
44 | virtual ~QDesignerCustomWidgetInterface() {} |
45 | |
46 | virtual QString name() const = 0; |
47 | virtual QString group() const = 0; |
48 | virtual QString toolTip() const = 0; |
49 | virtual QString whatsThis() const = 0; |
50 | virtual QString includeFile() const = 0; |
51 | virtual QIcon icon() const = 0; |
52 | |
53 | virtual bool isContainer() const = 0; |
54 | |
55 | virtual QWidget *createWidget(QWidget *parent) = 0; |
56 | |
57 | virtual bool isInitialized() const { return false; } |
58 | virtual void initialize(QDesignerFormEditorInterface *core) { Q_UNUSED(core); } |
59 | |
60 | virtual QString domXml() const |
61 | { |
62 | return QString::fromUtf8(str: "<widget class=\"%1\" name=\"%2\"/>") |
63 | .arg(a: name()).arg(a: name().toLower()); |
64 | } |
65 | |
66 | virtual QString codeTemplate() const { return QString(); } |
67 | }; |
68 | |
69 | #define QDesignerCustomWidgetInterface_iid "org.qt-project.QDesignerCustomWidgetInterface" |
70 | |
71 | Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, QDesignerCustomWidgetInterface_iid) |
72 | |
73 | class QDesignerCustomWidgetCollectionInterface |
74 | { |
75 | public: |
76 | virtual ~QDesignerCustomWidgetCollectionInterface() {} |
77 | |
78 | virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0; |
79 | }; |
80 | |
81 | #define QDesignerCustomWidgetCollectionInterface_iid "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface" |
82 | |
83 | Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface, QDesignerCustomWidgetCollectionInterface_iid) |
84 | |
85 | QT_END_NAMESPACE |
86 | |
87 | #endif // CUSTOMWIDGET_H |
88 |