Managing widget plugin in Qt Designer
Hi there,
It's me again.
So , now that My first widget plugin source code compile, I see something strange. My plugin does not appear in the "Custom Widgets" category, instead a new category also called "Custom Widgets" has been created but does not contain any plugin. If a choose a different category such as "Input", my widget is added into that category.
So what's wrong with this ? What should I do to add my plugin in the "Custom Widgets" category ?
Thanks in advance
Re: Managing widget plugin in Qt Designer
can you post your QWidgetPlugin subclass implementation?
Re: Managing widget plugin in Qt Designer
Here it is :
Code:
#include "ColorChooserPlugin.h"
#include ".\\..\\WidgetSource\\ColorChooser.h"
CColorChooserPlugin::CColorChooserPlugin()
:QWidgetPlugin()
{
}
{
list << "CColorChooserPlugin";
return list;
}
QWidget* CColorChooserPlugin
::create(const QString
& key,
QWidget* parent,
const char* name
) {
if( key == "CColorChooserPlugin" )
return new CColorChooser(parent, name);
return 0;
}
QString CColorChooserPlugin
::includeFile(const QString
& feature
) const {
if( feature == "CColorChooserPlugin" )
return "ColorChooser.h";
}
QString CColorChooserPlugin
::group(const QString
& feature
) const {
if( feature == "CColorChooserPlugin" )
return "Custom Widgets";
}
QIconSet CColorChooserPlugin::iconSet(const QString& feature) const
{
return QIconSet
( QPixmap("colorchooser_pixmap.png"));
}
QString CColorChooserPlugin
::toolTip(const QString
& feature
) const {
if( feature == "CColorChooserPlugin" )
return "Color Chooser Widget";
}
QString CColorChooserPlugin
::whatsThis(const QString
& feature
) const {
if( feature == "CColorChooserPlugin" )
return "A widget to choose a color";
}
bool CColorChooserPlugin::isContainer(const QString& feature) const
{
return FALSE;
}
Q_EXPORT_PLUGIN( CColorChooserPlugin );
Re: Managing widget plugin in Qt Designer
Another question is how to integrate and use a plugin into an application.
Should I include any headers or anything else ?
Re: Managing widget plugin in Qt Designer
Quote:
My plugin does not appear in the "Custom Widgets" category, instead a new category also called "Custom Widgets" has been created but does not contain any plugin. If a choose a different category such as "Input", my widget is added into that category.
I don't see any thing wrong with your code, that could explain that behaviour.
Quote:
Should I include any headers or anything else ?
Yes, include the headers of your plugin, and link to the *.so/*.dll like a normal library.
[SOLVE] Re: Managing widget plugin in Qt Designer
Re: Managing widget plugin in Qt Designer
Would you mind sharing what was the problem and the solution?:)
Re: Managing widget plugin in Qt Designer
Yes,
So I still don't know why the plugin never appears in the category "Custom Widget" when I specify it, and I don't know yet why it appears in the 'Input" category when I specify it. For the moment I add it to "Input" ... I know it is not a clean solution but I don't have time to find out why for the moment.
About the usage of a plugin, I add it in my dialog with Qt Designer, then I add the header file in the implementation still with Qt Designer. Then with Visual C++ 6.0, I add the .cpp, the .h and the moc file of my widget.
Re: Managing widget plugin in Qt Designer
Quote:
Originally Posted by yellowmat
Yes,
About the usage of a plugin, I add it in my dialog with Qt Designer, then I add the header file in the implementation still with Qt Designer. Then with Visual C++ 6.0, I add the .cpp, the .h and the moc file of my widget.
You need not include the .moc, .cpp
The whole idea of creating a .so/.dll is that you need not include it in the project. Instead use the.
LIBS += -lfilechooser in your .pro
the Application will be linked to that