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
abstractwidgetbox.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef ABSTRACTWIDGETBOX_H
5#define ABSTRACTWIDGETBOX_H
6
7#include <QtDesigner/sdk_global.h>
8
9#include <QtCore/qshareddata.h>
10#include <QtCore/qmetatype.h>
11#include <QtWidgets/qwidget.h>
12#include <QtGui/qicon.h>
13
15
16class DomUI;
17class QDesignerDnDItemInterface;
18
20
21class QDESIGNER_SDK_EXPORT QDesignerWidgetBoxInterface : public QWidget
22{
23 Q_OBJECT
24public:
25 class QDESIGNER_SDK_EXPORT Widget
26 {
27 public:
28 enum Type { Default, Custom };
29 Widget(const QString &aname = QString(), const QString &xml = QString(),
30 const QString &icon_name = QString(), Type atype = Default);
31 ~Widget();
32 Widget(const Widget &w);
33 Widget &operator=(const Widget &w);
34
35 QString name() const;
36 void setName(const QString &aname);
37 QString domXml() const;
38 void setDomXml(const QString &xml);
39 QString iconName() const;
40 void setIconName(const QString &icon_name);
41 Type type() const;
42 void setType(Type atype);
43
44 bool isNull() const;
45
46 private:
47 QSharedDataPointer<QDesignerWidgetBoxWidgetData> m_data;
48 };
49
50 using WidgetList = QList<Widget>;
51
52 class Category
53 {
54 public:
55 enum Type { Default, Scratchpad };
56
57 Category(const QString &aname = QString(), Type atype = Default)
58 : m_name(aname), m_type(atype) {}
59
60 QString name() const { return m_name; }
61 void setName(const QString &aname) { m_name = aname; }
62 int widgetCount() const { return int(m_widget_list.size()); }
63 Widget widget(int idx) const { return m_widget_list.at(idx); }
64 void removeWidget(int idx) { m_widget_list.removeAt(idx); }
65 void addWidget(const Widget &awidget) { m_widget_list.append(awidget); }
66 Type type() const { return m_type; }
67 void setType(Type atype) { m_type = atype; }
68
69 bool isNull() const { return m_name.isEmpty(); }
70
71 private:
72 QString m_name;
73 Type m_type;
74 WidgetList m_widget_list;
75 };
76
77 using CategoryList = QList<Category>;
78
79 explicit QDesignerWidgetBoxInterface(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
80 virtual ~QDesignerWidgetBoxInterface();
81
82 virtual int categoryCount() const = 0;
83 virtual Category category(int cat_idx) const = 0;
84 virtual void addCategory(const Category &cat) = 0;
85 virtual void removeCategory(int cat_idx) = 0;
86
87 virtual int widgetCount(int cat_idx) const = 0;
88 virtual Widget widget(int cat_idx, int wgt_idx) const = 0;
89 virtual void addWidget(int cat_idx, const Widget &wgt) = 0;
90 virtual void removeWidget(int cat_idx, int wgt_idx) = 0;
91
92 int findOrInsertCategory(const QString &categoryName);
93
94 virtual void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list,
95 const QPoint &global_mouse_pos) = 0;
96
97 virtual void setFileName(const QString &file_name) = 0;
98 virtual QString fileName() const = 0;
99 virtual bool load() = 0;
100 virtual bool save() = 0;
101};
102
103QT_END_NAMESPACE
104
105Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerWidgetBoxInterface::Widget))
106
107#endif // ABSTRACTWIDGETBOX_H
QDesignerIntegrationInterfacePrivate(QDesignerFormEditorInterface *core)
QDesignerFormEditorInterface * m_core
The QDesignerIntegrationInterface glues together parts of \QD and allows for overwriting functionalit...
The QDesignerIntegration class is \QD's implementation of QDesignerIntegrationInterface.
virtual QString propertyGroup(int index) const =0
virtual int indexOf(const QString &name) const =0
The QDesignerWidgetBoxInterface class allows you to control the contents of \QD's widget box.
friend class QWidget
Definition qpainter.h:421
void getSelection(qdesigner_internal::Selection &s)
static void initializePlugins(QDesignerFormEditorInterface *formEditor)
QDesignerIntegrationInterface::Feature m_features
void setupFormWindow(QDesignerFormWindowInterface *formWindow)
void addDynamicProperty(const QString &name, const QVariant &value)
void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling)
QDesignerIntegrationInterface::ResourceFileWatcherBehaviour m_resourceFileWatcherBehaviour
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QString fixHelpClassName(const QString &className)
static QString classForProperty(QDesignerFormEditorInterface *core, QObject *object, const QString &property)