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