I was able to reproduce your problem and it seems that Designer gets confused when you have two plugins for widgets with the same class name.
Make sure:- that the name of a class in XML snippet returned by domXml() and the string returned by name() are the same as the widget's class name,
- that there are no other plugins which name() method returns the same string (you might already have one plugin for AnalogClock widget installed),
- and finally that you compile your plugin in release mode.
Rename AnalogClock to something like AnalogClockX, update your plugin's code:
...
QString AnalogClockPlugin
::name() const {
return "AnalogClockX";
}
...
QString AnalogClockPlugin
::domXml() const {
return "<widget class=\"AnalogClockX\" name=\"analogClock\">\n"
...
"</widget>\n";
}
...
QString AnalogClockPlugin
::includeFile() const {
return "mycustom.h";
}
...
QString AnalogClockPlugin::name() const
{
return "AnalogClockX";
}
...
QString AnalogClockPlugin::domXml() const
{
return "<widget class=\"AnalogClockX\" name=\"analogClock\">\n"
...
"</widget>\n";
}
...
QString AnalogClockPlugin::includeFile() const
{
return "mycustom.h";
}
To copy to clipboard, switch view to plain text mode
and run:
make -f Makefile.Release
make -f Makefile.Release
To copy to clipboard, switch view to plain text mode
After this you should get a working plugin:
<customwidget>
<class>AnalogClockX</class>
<extends>QWidget</extends>
<header>mycustom.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>AnalogClockX</class>
<extends>QWidget</extends>
<header>mycustom.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
To copy to clipboard, switch view to plain text mode
Bookmarks