Hi,

I've followed this tutorial http://web.mit.edu/qt-dynamic/www/de...getplugin.html to create my own customized widget. After doing the "make" and "make install" I've seen a library file created in my workspace and as well as in the /designer directory. However when I reload the designer, I don't see my custom widget in the widget box. Please help, these are the things that I've accomplished so far.

The .pro file.

Qt Code:
  1. CONFIG += designer \
  2. plugin \
  3. debug_and_release
  4. TEMPLATE = lib
  5. HEADERS += QCustomDialog.h \
  6. QCustomDialogPlugin.h
  7. SOURCES += QCustomDialog.cpp \
  8. QCustomDialogPlugin.cpp
  9.  
  10. target.path = $$[QT_INSTALL_PLUGINS]/designer
  11. INSTALLS += target
To copy to clipboard, switch view to plain text mode 

Here's my custom widget plugin.

Qt Code:
  1. #ifndef QCUSTOMDIALOGPLUGIN_H
  2. #define QCUSTOMDIALOGPLUGIN_H
  3.  
  4. #include <QDesignerCustomWidgetInterface>
  5.  
  6. class QCustomDialogPlugin : public QObject, public QDesignerCustomWidgetInterface
  7. {
  8. Q_OBJECT
  9.  
  10. public:
  11. QCustomDialogPlugin(QObject *parent = 0);
  12.  
  13. bool isContainer() const;
  14. bool isInitialized() const;
  15. QIcon icon() const;
  16. QString domXml() const;
  17. QString group() const;
  18. QString includeFile() const;
  19. QString name() const;
  20. QString toolTip() const;
  21. QString whatsThis() const;
  22. QWidget *createWidget(QWidget *parent);
  23. void initialize(QDesignerFormEditorInterface *core);
  24.  
  25. private:
  26. bool initialized;
  27. };
  28.  
  29.  
  30. #endif // QCUSTOMDIALOGPLUGIN_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "QCustomDialogPlugin.h"
  2. #include "QCustomDialog.h"
  3. #include <QString>
  4. #include <QObject>
  5. #include <QtPlugin>
  6.  
  7. QCustomDialogPlugin::QCustomDialogPlugin(QObject *parent)
  8. : QObject(parent)
  9. {
  10. initialized = false;
  11. }
  12.  
  13. bool QCustomDialogPlugin::isInitialized() const
  14. {
  15. return initialized;
  16. }
  17.  
  18. QWidget *QCustomDialogPlugin::createWidget(QWidget *parent)
  19. {
  20. return new QCustomDialog(parent);
  21. }
  22.  
  23. QString QCustomDialogPlugin::name() const
  24. {
  25. return "QCustomDialog";
  26. }
  27.  
  28. QString QCustomDialogPlugin::group() const
  29. {
  30. return "Display Widgets [Examples]";
  31. }
  32.  
  33. QIcon QCustomDialogPlugin::icon() const
  34. {
  35. return QIcon();
  36. }
  37.  
  38. QString QCustomDialogPlugin::toolTip() const
  39. {
  40. return "";
  41. }
  42.  
  43. QString QCustomDialogPlugin::whatsThis() const
  44. {
  45. return "";
  46. }
  47.  
  48. bool QCustomDialogPlugin::isContainer() const
  49. {
  50. return true;
  51. }
  52.  
  53. QString QCustomDialogPlugin::domXml() const
  54. {
  55. return "<widget class=\"QCustomDialog\" name=\"customDialog\">\n"
  56. " <property name=\"geometry\">\n"
  57. " <rect>\n"
  58. " <x>0</x>\n"
  59. " <y>0</y>\n"
  60. " <width>400</width>\n"
  61. " <height>200</height>\n"
  62. " </rect>\n"
  63. " </property>\n"
  64. " <property name=\"toolTip\" >\n"
  65. " <string>The current time</string>\n"
  66. " </property>\n"
  67. " <property name=\"whatsThis\" >\n"
  68. " <string>Qt Custom Dialog "
  69. "the current time.</string>\n"
  70. " </property>\n"
  71. "</widget>\n";
  72. }
  73.  
  74. QString QCustomDialogPlugin::includeFile() const
  75. {
  76. return "QCustomDialog.h";
  77. }
  78.  
  79. Q_EXPORT_PLUGIN2(libCustomWidget, QCustomDialogPlugin)
To copy to clipboard, switch view to plain text mode 

I have not posted the widget class itself because I believe its already working. I've tried using it manually or without using the designer and it shows when run.