8memberSheet = qt_extension<QDesignerMemberSheetExtension*>(manager, widget);
9int index = memberSheet->indexOf(setEchoMode);
10memberSheet->setVisible(index,
false);
17class MyMemberSheetExtension :
public QObject,
18 public QDesignerMemberSheetExtension
21 Q_INTERFACES(QDesignerMemberSheetExtension)
30QObject *ANewExtensionFactory::createExtension(QObject *object,
31 const QString &iid, QObject *parent)
const
33 if (iid != Q_TYPEID(QDesignerMemberSheetExtension))
36 if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
38 return new MyMemberSheetExtension(widget, parent);
46QObject *AGeneralExtensionFactory::createExtension(QObject *object,
47 const QString &iid, QObject *parent)
const
49 MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
51 if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
52 return new MyTaskMenuExtension(widget, parent);
54 }
else if (widget && (iid == Q_TYPEID(QDesignerMemberSheetExtension))) {
55 return new MyMemberSheetExtension(widget, parent);
69 Q_INTERFACES(QDesignerContainerExtension)
83 MyCustomWidget *myWidget;
89QObject *ANewExtensionFactory::createExtension(QObject *object,
90 const QString &iid, QObject *parent)
const
92 if (iid != Q_TYPEID(QDesignerContainerExtension))
95 if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
97 return new MyContainerExtension(widget, parent);
105QObject *AGeneralExtensionFactory::createExtension(QObject *object,
106 const QString &iid, QObject *parent)
const
108 MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
110 if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
111 return new MyTaskMenuExtension(widget, parent);
113 }
else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
114 return new MyContainerExtension(widget, parent);
128 Q_INTERFACES(QDesignerTaskMenuExtension)
140 MyCustomWidget *widget;
147QObject *ANewExtensionFactory::createExtension(QObject *object,
148 const QString &iid, QObject *parent)
const
150 if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
153 if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object))
154 return new MyTaskMenuExtension(widget, parent);
162QObject *AGeneralExtensionFactory::createExtension(QObject *object,
163 const QString &iid, QObject *parent)
const
165 MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
167 if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
168 return new MyContainerExtension(widget, parent);
170 }
else if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
171 return new MyTaskMenuExtension(widget, parent);
181#include customwidgetoneinterface.h
182#include customwidgettwointerface.h
183#include customwidgetthreeinterface.h
185#include <QtDesigner/qtdesigner.h>
186#include <QtCore/qplugin.h>
191 Q_PLUGIN_METADATA(IID
"org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface")
200 QList<QDesignerCustomWidgetInterface*> widgets;
209 widgets.append(
new CustomWidgetOneInterface(
this));
210 widgets.append(
new CustomWidgetTwoInterface(
this));
211 widgets.append(
new CustomWidgetThreeInterface(
this));
222Q_PLUGIN_METADATA(IID
"org.qt-project.Qt.QDesignerCustomWidgetInterface")
227QDesignerPropertySheetExtension *propertySheet =
nullptr;
230propertySheet = qt_extension<QDesignerPropertySheetExtension*>(manager, widget);
231int index = propertySheet->indexOf(u"margin"_s);
233propertySheet->setProperty(index, 10);
234propertySheet->setChanged(index,
true);
241class MyPropertySheetExtension :
public QObject,
242 public QDesignerPropertySheetExtension
245 Q_INTERFACES(QDesignerPropertySheetExtension)
254QObject *ANewExtensionFactory::createExtension(QObject *object,
255 const QString &iid, QObject *parent)
const
257 if (iid != Q_TYPEID(QDesignerPropertySheetExtension))
260 if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
262 return new MyPropertySheetExtension(widget, parent);
270QObject *AGeneralExtensionFactory::createExtension(QObject *object,
271 const QString &iid, QObject *parent)
const
273 MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
275 if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
276 return new MyTaskMenuExtension(widget, parent);
278 }
else if (widget && (iid == Q_TYPEID(QDesignerPropertySheetExtension))) {
279 return new MyPropertySheetExtension(widget, parent);
void setCurrentIndex(int index)
QWidget * widget(int index) const
void addWidget(QWidget *widget)
void insertWidget(int index, QWidget *widget)
QDesignerMemberSheetExtension * memberSheet
[2]
QNetworkAccessManager manager
[0]