DesignerPlugin
Verfasst: 4. Mai 2010 11:07
Hi,
bin grade dabei mir ein eigenes Widget für den Designer zu schreiben.
Ich halte mich dabei an das Custom Widget Plugin Example(aus den Examples).
Allerdings knallt es bei mir noch ...
proFile:
Die Klass:
bin grade dabei mir ein eigenes Widget für den Designer zu schreiben.
Ich halte mich dabei an das Custom Widget Plugin Example(aus den Examples).
Allerdings knallt es bei mir noch ...
Das ist beim Q_EXPORTPlugin2()navigationdesignerplugin.cpp:83: error: expected constructor, destructor, or type conversion at end of input
make: *** [navigationdesignerplugin.o] Error 1
Code: Alles auswählen
Q_EXPORT_PLUGIN2(NavigationWidget, NavigationDesignerPlugin)Code: Alles auswählen
TEMPLATE = lib
TARGET += $$qtLibraryTarget($$TARGET)
CONFIG += designer \
plugin
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
HEADERS += navigationdesignerplugin.h \
navigationwidget.h
SOURCES += navigationdesignerplugin.cpp \
navigationwidget.cpp
FORMS += navigationwidget.ui
RESOURCES += resource.qrc
# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES \
$$HEADERS \
*.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/NavigationWidget
INSTALLS += target \
sources
Die Klass:
Code: Alles auswählen
class NavigationDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
NavigationDesignerPlugin(QObject *parent = 0);
/*
Since we (need to) implement QDesignerCustomWidgetInterface we need to fill this with some code
so the QtDesigner can load the plugin.
*/
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
Jemand von euch eine Idee????