| 1 |
// Copyright (C) 2016 Stephen Kelly <[email protected]> |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
#include <QtDesigner> |
| 5 |
#include <QtDesigner/QtDesigner> |
| 6 |
#include <QtDesigner/QDesignerCustomWidgetInterface> |
| 7 |
#include <QDesignerCustomWidgetInterface> |
| 8 |
|
| 9 |
#include <QWidget> |
| 10 |
|
| 11 |
#if TEST_UIPLUGIN_USAGE_REQUIREMENTS |
| 12 |
# ifndef QT_UIPLUGIN_LIB |
| 13 |
# error Expect QT_UIPLUGIN_LIB define |
| 14 |
# endif |
| 15 |
#endif |
| 16 |
|
| 17 |
class MyPlugin : public QObject, public QDesignerCustomWidgetInterface |
| 18 |
{ |
| 19 |
Q_OBJECT |
| 20 |
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface") |
| 21 |
Q_INTERFACES(QDesignerCustomWidgetInterface) |
| 22 |
public: |
| 23 |
MyPlugin(QObject *parent = 0) |
| 24 |
: QObject(parent) |
| 25 |
, initialized(false) |
| 26 |
{ |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
bool isContainer() const { return true; } |
| 31 |
bool isInitialized() const { return initialized; } |
| 32 |
QIcon icon() const { return QIcon(); } |
| 33 |
QString domXml() const { return QString(); } |
| 34 |
QString group() const { return QString(); } |
| 35 |
QString includeFile() const { return QString(); } |
| 36 |
QString name() const { return QString(); } |
| 37 |
QString toolTip() const { return QString(); } |
| 38 |
QString whatsThis() const { return QString(); } |
| 39 |
QWidget *createWidget(QWidget *parent) { return new QWidget(parent); } |
| 40 |
void initialize(QDesignerFormEditorInterface *) |
| 41 |
{ |
| 42 |
if (initialized) |
| 43 |
return; |
| 44 |
initialized = true; |
| 45 |
} |
| 46 |
|
| 47 |
private: |
| 48 |
bool initialized; |
| 49 |
}; |
| 50 |
|
| 51 |
#include "my_designer_plugin.moc" |