Hi,

Here I am once again.

I'm trying to developp my own custom widget. I did it well the old fashion way but when I try to do it as a plugin it fails at compilation, invoking a problem with my Constructor, I don't know why so I hopre someone could help me.

The widget I'm trying to developp is a FileChooser from Qt Tutorial.

The compilation error message is the following :
Qt Code:
  1. error C2533 CustomWidgetPlugin::CustomWidgetPlugin : constructor not allowed a return type
To copy to clipboard, switch view to plain text mode 

... I'm pretty sure that it does not return any value, so why does the compilation failed ?

Here is my code for the .h
Qt Code:
  1. #include <qwidgetplugin.h>
  2.  
  3. class CustomWidgetPlugin : public QWidgetPlugin
  4. {
  5. public:
  6. CustomWidgetPlugin();
  7.  
  8. QStringList keys() const;
  9. QWidget* create(const QString& classname, QWidget* parent=0, const char* name=0);
  10. QString group(const QString&) const;
  11. QIconSet iconSet(const QString&) const;
  12. QString includeFile(const QString&) const;
  13. QString toolTip(const QString&) const;
  14. QString whatsThis(const QString&) const;
  15. bool isContainer(const QString&) const;
  16. }
To copy to clipboard, switch view to plain text mode 

the code for the .cpp
Qt Code:
  1. #include "CustomWidgetPlugin.h"
  2.  
  3. CustomWidgetPlugin::CustomWidgetPlugin()
  4. {
  5.  
  6. }
  7.  
  8. QStringList CustomWidgetPlugin::keys() const
  9. {
  10. list << "FileChooser";
  11. return list;
  12. }
  13.  
  14. QWidget* CustomWidgetPlugin::create(const QString& key, QWidget* parent, const char* name) const
  15. {
  16. if( key == "FileChooser" )
  17. return new FileChooser(parent, name);
  18. return 0;
  19. }
  20.  
  21. QString CustomWidgetPlugin::includeFile(const QString& feature) const
  22. {
  23. if( feature == "FileChooser" )
  24. return "filechooser.h";
  25. return QString::null;
  26. }
  27.  
  28. QString CustomWidgetPlugin::group(const QString& feature) const
  29. {
  30. if( feature == "FileChooser" )
  31. return "Input";
  32. return QString::null;
  33. }
  34.  
  35. QIconSet CustomWidgetPlugin::iconSet(const QString& feature) const
  36. {
  37. return QIconSet( QPixmap("filechooser_pixmap.png"));
  38. }
  39.  
  40. QString CustomWidgetPlugin::toolTip(const QString& feature) const
  41. {
  42. if( feature == "FileChooser" )
  43. return "File Chooser Widget";
  44. return QString::null;
  45. }
  46.  
  47. QString CustomWidgetPlugin::whatsThis(const QString& feature) const
  48. {
  49. if( feature == "FileChooser" )
  50. return "A widget to choose a file";
  51. return QString::null;
  52. }
  53.  
  54. bool CustomWidgetPlugin::isContainer(const QString& feature) const
  55. {
  56. return FALSE;
  57. }
  58.  
  59. Q_EXPORT_PLUGIN( CustomWidgetPlugin )
To copy to clipboard, switch view to plain text mode 

and my .pro
Qt Code:
  1. SOURCES += CustomWidgetPlugin.cpp ../FileChooser/filechooser.cpp
  2. HEADERS += CustomWidgetPlugin.h ../FileChooser/filechooser.h
  3. DESTDIR = $(QTDIR)/plugins/designer
  4. TARGET = filechooser
  5.  
  6. target.path=$$plugins.path
  7. isEmpty(target.path):target.path==$$QT_PREFIX/plugins
  8. INSTALLS += target
  9. TEMPLATE = lib
  10. CONFIG += qt warn_on release plugin
  11. INCLUDEPATH += $(QTDIR)/tools/designer/interfaces
  12. DBFILE = CustomWidgetPlugin.db
  13. PROJECTNAME = CustomWidgetPlugin
  14. LANGUAGE = C++
To copy to clipboard, switch view to plain text mode 

Thanks in advance for your help.