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 ABSTRACTWIDGETDATABASE_H
30 #define ABSTRACTWIDGETDATABASE_H
31 
32 #include <QtDesigner/sdk_global.h>
33 
34 #include <QtCore/qobject.h>
35 #include <QtCore/qlist.h>
36 
37 QT_BEGIN_NAMESPACE
38 
39 class QIcon;
40 class QString;
41 class QDesignerFormEditorInterface;
42 class QDebug;
43 
44 class QDesignerWidgetDataBaseItemInterface
45 {
46 public:
~QDesignerWidgetDataBaseItemInterface()47     virtual ~QDesignerWidgetDataBaseItemInterface() {}
48 
49     virtual QString name() const = 0;
50     virtual void setName(const QString &name) = 0;
51 
52     virtual QString group() const = 0;
53     virtual void setGroup(const QString &group) = 0;
54 
55     virtual QString toolTip() const = 0;
56     virtual void setToolTip(const QString &toolTip) = 0;
57 
58     virtual QString whatsThis() const = 0;
59     virtual void setWhatsThis(const QString &whatsThis) = 0;
60 
61     virtual QString includeFile() const = 0;
62     virtual void setIncludeFile(const QString &includeFile) = 0;
63 
64     virtual QIcon icon() const = 0;
65     virtual void setIcon(const QIcon &icon) = 0;
66 
67     virtual bool isCompat() const = 0;
68     virtual void setCompat(bool compat) = 0;
69 
70     virtual bool isContainer() const = 0;
71     virtual void setContainer(bool container) = 0;
72 
73     virtual bool isCustom() const = 0;
74     virtual void setCustom(bool custom) = 0;
75 
76     virtual QString pluginPath() const = 0;
77     virtual void setPluginPath(const QString &path) = 0;
78 
79     virtual bool isPromoted() const = 0;
80     virtual void setPromoted(bool b) = 0;
81 
82     virtual QString extends() const = 0;
83     virtual void setExtends(const QString &s) = 0;
84 
85     virtual void setDefaultPropertyValues(const QList<QVariant> &list) = 0;
86     virtual QList<QVariant> defaultPropertyValues() const = 0;
87 };
88 
89 class QDESIGNER_SDK_EXPORT QDesignerWidgetDataBaseInterface: public QObject
90 {
91     Q_OBJECT
92 public:
93     explicit QDesignerWidgetDataBaseInterface(QObject *parent = nullptr);
94     virtual ~QDesignerWidgetDataBaseInterface();
95 
96     virtual int count() const;
97     virtual QDesignerWidgetDataBaseItemInterface *item(int index) const;
98 
99     virtual int indexOf(QDesignerWidgetDataBaseItemInterface *item) const;
100     virtual void insert(int index, QDesignerWidgetDataBaseItemInterface *item);
101     virtual void append(QDesignerWidgetDataBaseItemInterface *item);
102 
103     virtual int indexOfObject(QObject *object, bool resolveName = true) const;
104     virtual int indexOfClassName(const QString &className, bool resolveName = true) const;
105 
106     virtual QDesignerFormEditorInterface *core() const;
107 
108     bool isContainer(QObject *object, bool resolveName = true) const;
109     bool isCustom(QObject *object, bool resolveName = true) const;
110 
111 Q_SIGNALS:
112     void changed();
113 
114 protected:
115     QList<QDesignerWidgetDataBaseItemInterface *> m_items;
116 };
117 
118 QT_END_NAMESPACE
119 
120 #endif // ABSTRACTWIDGETDATABASE_H
121