4#ifndef ABSTRACTWIDGETBOX_H
5#define ABSTRACTWIDGETBOX_H
7#include <QtDesigner/sdk_global.h>
9#include <QtCore/qshareddata.h>
10#include <QtCore/qmetatype.h>
11#include <QtWidgets/qwidget.h>
12#include <QtGui/qicon.h>
17class QDesignerDnDItemInterface;
25 class QDESIGNER_SDK_EXPORT Widget
28 enum Type { Default, Custom };
29 Widget(
const QString &aname = QString(),
const QString &xml = QString(),
30 const QString &icon_name = QString(), Type atype = Default);
32 Widget(
const Widget &w);
33 Widget &operator=(
const Widget &w);
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);
42 void setType(Type atype);
47 QSharedDataPointer<QDesignerWidgetBoxWidgetData> m_data;
50 using WidgetList = QList<Widget>;
55 enum Type { Default, Scratchpad };
57 Category(
const QString &aname = QString(), Type atype = Default)
58 : m_name(aname), m_type(atype) {}
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; }
69 bool isNull()
const {
return m_name.isEmpty(); }
74 WidgetList m_widget_list;
77 using CategoryList = QList<Category>;
79 explicit QDesignerWidgetBoxInterface(QWidget *parent =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
80 virtual ~QDesignerWidgetBoxInterface();
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;
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;
92 int findOrInsertCategory(
const QString &categoryName);
94 virtual void dropWidgets(
const QList<QDesignerDnDItemInterface*> &item_list,
95 const QPoint &global_mouse_pos) = 0;
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;
105Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerWidgetBoxInterface::Widget))
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
void getSelection(qdesigner_internal::Selection &s)
static void initializePlugins(QDesignerFormEditorInterface *formEditor)
QString contextHelpId() const
QDesignerIntegrationInterface::Feature m_features
void setupFormWindow(QDesignerFormWindowInterface *formWindow)
void addDynamicProperty(const QString &name, const QVariant &value)
QDesignerIntegrationPrivate(QDesignerIntegration *qq)
QObject * propertyEditorObject()
void updateCustomWidgetPlugins()
QWidget * containerWindow(QWidget *widget) const
QtGradientManager * m_gradientManager
void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling)
QDesignerIntegrationInterface::ResourceFileWatcherBehaviour m_resourceFileWatcherBehaviour
void removeDynamicProperty(const QString &name)
void resetProperty(const QString &name)
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)