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// Qt-Security score:significant reason:default
4
5#ifndef ABSTRACTWIDGETBOX_H
6#define ABSTRACTWIDGETBOX_H
7
8#include <QtDesigner/sdk_global.h>
9
10#include <QtCore/qshareddata.h>
11#include <QtCore/qmetatype.h>
12#include <QtWidgets/qwidget.h>
13#include <QtGui/qicon.h>
14
16
17class DomUI;
18class QDesignerDnDItemInterface;
19
21
22class QDESIGNER_SDK_EXPORT QDesignerWidgetBoxInterface : public QWidget
23{
24 Q_OBJECT
25public:
26 class QDESIGNER_SDK_EXPORT Widget
27 {
28 public:
29 enum Type { Default, Custom };
30 Widget(const QString &aname = QString(), const QString &xml = QString(),
31 const QString &icon_name = QString(), Type atype = Default);
32 ~Widget();
33 Widget(const Widget &w);
34 Widget &operator=(const Widget &w);
35
36 QString name() const;
37 void setName(const QString &aname);
38 QString domXml() const;
39 void setDomXml(const QString &xml);
40 QString iconName() const;
41 void setIconName(const QString &icon_name);
42 Type type() const;
43 void setType(Type atype);
44
45 bool isNull() const;
46
47 private:
48 QSharedDataPointer<QDesignerWidgetBoxWidgetData> m_data;
49 };
50
51 using WidgetList = QList<Widget>;
52
53 class Category
54 {
55 public:
56 enum Type { Default, Scratchpad };
57
58 Category(const QString &aname = QString(), Type atype = Default)
59 : m_name(aname), m_type(atype) {}
60
61 QString name() const { return m_name; }
62 void setName(const QString &aname) { m_name = aname; }
63 int widgetCount() const { return int(m_widget_list.size()); }
64 Widget widget(int idx) const { return m_widget_list.at(idx); }
65 void removeWidget(int idx) { m_widget_list.removeAt(idx); }
66 void addWidget(const Widget &awidget) { m_widget_list.append(awidget); }
67 Type type() const { return m_type; }
68 void setType(Type atype) { m_type = atype; }
69
70 bool isNull() const { return m_name.isEmpty(); }
71
72 private:
73 QString m_name;
74 Type m_type;
75 WidgetList m_widget_list;
76 };
77
78 using CategoryList = QList<Category>;
79
80 explicit QDesignerWidgetBoxInterface(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
81 ~QDesignerWidgetBoxInterface() override;
82
83 virtual int categoryCount() const = 0;
84 virtual Category category(int cat_idx) const = 0;
85 virtual void addCategory(const Category &cat) = 0;
86 virtual void removeCategory(int cat_idx) = 0;
87
88 virtual int widgetCount(int cat_idx) const = 0;
89 virtual Widget widget(int cat_idx, int wgt_idx) const = 0;
90 virtual void addWidget(int cat_idx, const Widget &wgt) = 0;
91 virtual void removeWidget(int cat_idx, int wgt_idx) = 0;
92
93 int findOrInsertCategory(const QString &categoryName);
94
95 virtual void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list,
96 const QPoint &global_mouse_pos) = 0;
97
98 virtual void setFileName(const QString &file_name) = 0;
99 virtual QString fileName() const = 0;
100 virtual bool load() = 0;
101 virtual bool save() = 0;
102};
103
105
106Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerWidgetBoxInterface::Widget))
107
108#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:432
static void restoreState(QtGradientManager *manager, const QString &state)
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)
QT_END_NAMESPACE Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhos::enums::kit::ShareKit::systemShare::SelectionMode))