PDA

View Full Version : Q_EXPORT_PLUGIN2 proplem



high_flyer
1st February 2006, 21:35
Hi,

Qt4.1.0 GPL, MinGW, WinXP.
I am trying to implement a QtDesigner plugin following the AnalogCLock example:
http://doc.trolltech.com/4.0/designer-customwidgetplugin.html
The online version of this example and the one which comes with the GPL bundle, are not the same.
The online version says:

Finally, we use the Q_EXPORT_PLUGIN macro to export the AnalogClockPlugin class for use with Qt Designer:

Q_EXPORT_PLUGIN(AnalogClockPlugin)

This macro ensures that Qt Designer can access and construct the custom widget. Without this macro, there is no way for Qt Designer to use the widget.

And the other:

Finally, we use the Q_EXPORT_PLUGIN() macro to export the AnalogClockPlugin class for use with Qt Designer:
Q_EXPORT_PLUGIN2(customwidgetplugin, AnalogClockPlugin)
This macro ensures that Qt Designer can access and construct the custom widget. Without this macro, there is no way for Qt Designer to use the widget.

However, that for it self is not my problemm since with both I get the following compile error:

89 C:\Dev-Cpp\projects\PStyledButtonPlugIn\pstyledbuttonplug in.cpp expected constructor, destructor, or type conversion at end of input

And here is the offending code from the PStyledButtonPlugin implementation file :

//Q_EXPORT_PLUGIN(PStyledButtonPlugin)
Q_EXPORT_PLUGIN2(PStyledButton, PStyledButtonPlugin)

Where the first parameter is the cutom widget class name, and the secod the plugin implementation class name.

What am I doing wrong?

P.S
Here is the macro decleration in qplugin.h:

# define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \
Q_PLUGIN_VERIFICATION_DATA \
Q_EXTERN_C Q_DECL_EXPORT \
const char * Q_STANDARD_CALL qt_plugin_query_verification_data() \
{ return qt_plugin_verification_data; } \
Q_EXTERN_C Q_DECL_EXPORT QObject * Q_STANDARD_CALL qt_plugin_instance() \
Q_PLUGIN_INSTANCE(PLUGINCLASS)


As you can see, the PLUGIN parmeter is not used, which is strange...
But either way, I can't make out what I am doing wrong...

high_flyer
2nd February 2006, 20:39
The problem was I didn't include #include <QtCore/qplugin.h>.