I want to add my customed widget to designer,but it doesn't work!
It said that in the function QWidget * NeonLightPlugin::createWidget(QWidget * parent) cannot convert 'NeonLightPlugin*' to 'Widget*'.
And it also said error: expected constructor, destructor, or type conversion before '(' token in the last line Q_EXPORT_PLUGIN2(NeonLight, NeonLightPlugin)!!!
What is wrong with it???
Thanks very much!

The plugin files are here:
neonlightplugin.h
Qt Code:
  1. #ifndef NEONLIGHTPLUGIN_H
  2. #define NEONLIGHTPLUGIN_H
  3. #include <QObject>
  4. #include <QIcon>
  5. #include <QWidget>
  6. #include <QString>
  7. #include <QDesignerCustomWidgetInterface>
  8.  
  9. class NeonLightPlugin:public QObject, public QDesignerCustomWidgetInterface
  10. {
  11. Q_OBJECT
  12.  
  13. public:
  14. NeonLightPlugin(QObject * parent = 0);
  15.  
  16. bool isContainer() const;
  17. QIcon icon() const;
  18. QString group() const;
  19. QString includeFile() const;
  20. QString name() const;
  21. QString toolTip() const;
  22. QString whatsThis() const;
  23. QWidget *createWidget(QWidget *parent);
  24. };
  25.  
  26. #endif // NEONLIGHTPLUGIN_H
To copy to clipboard, switch view to plain text mode 

And the neonlightplugin.cpp

Qt Code:
  1. #include <QWidget>
  2. #include "neonlightplugin.h"
  3.  
  4. NeonLightPlugin::NeonLightPlugin(QObject *parent)
  5. {
  6. }
  7.  
  8. QString NeonLightPlugin::name() const
  9. {
  10. return "NeonLight";
  11. }
  12.  
  13. QString NeonLightPlugin::includeFile() const
  14. {
  15. return "neonlight.h";
  16. }
  17.  
  18. QString NeonLightPlugin::group() const
  19. {
  20. return tr("Special Effect");
  21. }
  22.  
  23. QIcon NeonLightPlugin::icon() const
  24. {
  25. return QIcon(":/file/resources/light.png");
  26. }
  27.  
  28. QString NeonLightPlugin::toolTip() const
  29. {
  30. return tr("A neon light widget for special effect");
  31.  
  32. }
  33.  
  34. QString NeonLightPlugin::whatsThis()const
  35. {
  36. return tr("This widget is presented by Tan Le");
  37. }
  38.  
  39. bool NeonLightPlugin::isContainer() const
  40. {
  41. return false;
  42. }
  43.  
  44. QWidget * NeonLightPlugin::createWidget(QWidget * parent)
  45. {
  46. return new NeonLightPlugin(parent);
  47. }
  48.  
  49. Q_EXPORT_PLUGIN2(NeonLight, NeonLightPlugin)
To copy to clipboard, switch view to plain text mode