Instantly share code, notes, and snippets.
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save paule32/c1d1cbfdb9e3e621cd2e2f097c3d4b6b to your computer and use it in GitHub Desktop.
plugin test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HEADERS += popupmenu.h | |
SOURCES += popupmenu.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "popupmenu.h" | |
#include <QMouseEvent> | |
#include <QPainter> | |
#include <QTimer> | |
PopupMenu::PopupMenu(QWidget *parent) | |
: QWidget(parent) | |
{ | |
setWindowTitle(tr("Popup Menu")); | |
resize(120, 120); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef POPUPMENU_H | |
#define POPUPMENU_H | |
#include <QTime> | |
#include <QWidget> | |
#include <QtUiPlugin/QDesignerExportWidget> | |
class QDESIGNER_WIDGET_EXPORT PopupMenu : public QWidget | |
{ | |
Q_OBJECT | |
public: | |
explicit PopupMenu(QWidget *parent = nullptr); | |
}; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
\"Name\" : \"PopupMenu\", | |
\"Version\" : \"4.5.0\", | |
\"CompatVersion\" : \"4.5.0\", | |
\"Vendor\" : \"paule\", | |
\"Copyright\" : \"(C) 2018 paule32\", | |
\"License\" : \"non-profit only\", | |
\"Description\" : \"extends QtCreator\", | |
\"Url\" : \"http://www.kallup.org\", | |
$$dependencyList | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONFIG += plugin debug | |
TARGET = PopupMenu | |
TEMPLATE = lib | |
HEADERS += popupmenuplugin.h | |
SOURCES += popupmenuplugin.cc | |
RESOURCES += icons.qrc | |
LIBS += -L. | |
#PLUGIN_TYPE = designer | |
#PLUGIN_CLASS_NAME = PopupMenu | |
OTHER_FILES += PopupMenu.json | |
QT += widgets uiplugin | |
target.path = /home/jens/qtcreator/4.5.0/lib/qtcreator/plugins | |
INSTALLS += target | |
include(popupmenu.pri) | |
DISTFILES += \ | |
popupmenu.pri \ | |
PopupMenu.json.in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "popupmenu.h" | |
#include "popupmenuplugin.h" | |
#include <QtPlugin> | |
PopupMenuPlugin::PopupMenuPlugin(QObject *parent) | |
: QObject(parent) | |
{ | |
} | |
void PopupMenuPlugin::initialize(QDesignerFormEditorInterface * /* core */) | |
{ | |
if (initialized) | |
return; | |
initialized = true; | |
} | |
bool PopupMenuPlugin::isInitialized() const | |
{ | |
return initialized; | |
} | |
QWidget *PopupMenuPlugin::createWidget(QWidget *parent) | |
{ | |
return new PopupMenu(parent); | |
} | |
QString PopupMenuPlugin::name() const | |
{ | |
return QStringLiteral("PopupMenu"); | |
} | |
QString PopupMenuPlugin::group() const | |
{ | |
return QStringLiteral("Display Widgets [kallup]"); | |
} | |
QIcon PopupMenuPlugin::icon() const | |
{ | |
return QIcon(); | |
} | |
QString PopupMenuPlugin::toolTip() const | |
{ | |
return QString(); | |
} | |
QString PopupMenuPlugin::whatsThis() const | |
{ | |
return QString(); | |
} | |
bool PopupMenuPlugin::isContainer() const | |
{ | |
return false; | |
} | |
QString PopupMenuPlugin::domXml() const | |
{ | |
return "<ui language=\"c++\">\n" | |
" <widget class=\"PopupMenu\" name=\"popupMenu\">\n" | |
" <property name=\"geometry\">\n" | |
" <rect>\n" | |
" <x>0</x>\n" | |
" <y>0</y>\n" | |
" <width>100</width>\n" | |
" <height>100</height>\n" | |
" </rect>\n" | |
" </property>\n" | |
" </widget>\n" | |
"</ui>"; | |
} | |
QString PopupMenuPlugin::includeFile() const | |
{ | |
return QStringLiteral("popupmenu.h"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef POPMENUPLUGIN_H | |
#define POPMENUPLUGIN_H | |
#include <QtUiPlugin/QDesignerCustomWidgetInterface> | |
class PopupMenuPlugin : | |
public QObject, | |
public QDesignerCustomWidgetInterface | |
{ | |
Q_OBJECT | |
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface") | |
Q_INTERFACES(QDesignerCustomWidgetInterface) | |
public: | |
explicit PopupMenuPlugin(QObject *parent = nullptr); | |
bool isContainer() const override; | |
bool isInitialized() const override; | |
QIcon icon() const override; | |
QString domXml() const override; | |
QString group() const override; | |
QString includeFile() const override; | |
QString name() const override; | |
QString toolTip() const override; | |
QString whatsThis() const override; | |
QWidget *createWidget(QWidget *parent) override; | |
void initialize(QDesignerFormEditorInterface *core) override; | |
private: | |
bool initialized = false; | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment