Hi All
i have made a plugin for designer and it is showing in designer and i can use it only problem is that none of the propertys typical for QListwidget is visible in designer even though i did let my class subclass QListwidget. It is only the baseclass QWidget propertys that is accesible which means that i cant access a lot of the propertys that is present in QListWidget.

Now! is this not possible to achive? it seems to me it must be possible since they can make QT3plugins visible and usable in designer with all the propertys visible.

I will post my code now and see if someone can tell me if it is possible and if maybe i have done something wrong. now the only thing i have donee is to add a variable of the type QDate to the QListView but this was only so that i could figure out how the plugin was made. I am going to add more functions if i get it to show up as an extended QListWidget in Designer

dateViewList.h defining the class dateViewList and letting it subclass QListWidget

Qt Code:
  1. #ifndef DATEVIEWLIST_H
  2. #define DATEVIEWLIST_H
  3. #include <QListView>
  4. #include <QDate>
  5. #include <QObject>
  6. #include <QWidget>
  7. #include <QtDesigner/QDesignerExportWidget>
  8. #include <QListWidget>
  9. #include <QObject>
  10.  
  11.  
  12. class QDESIGNER_WIDGET_EXPORT dateViewList : private QListWidget {
  13.  
  14. Q_OBJECT
  15.  
  16.  
  17. public :
  18. dateViewList(QWidget *parent );
  19.  
  20. public:
  21. void setDate(QDate otherDate);
  22.  
  23.  
  24. private:
  25. QDate displayDate;
  26.  
  27.  
  28. };
  29. #endif
To copy to clipboard, switch view to plain text mode 


Implementing Class dateListView.cpp
Qt Code:
  1. #include "dateViewList.h"
  2. #include <QDate>
  3. #include <qdatetime.h>
  4. #include <qwidget.h>
  5. #include<QtGui>
  6.  
  7.  
  8.  
  9. dateViewList:: dateViewList(QWidget *parent ){
  10.  
  11.  
  12. }
  13.  
  14. void dateViewList :: setDate(QDate otherDate){
  15.  
  16. this->displayDate = otherDate;
  17.  
  18. }
To copy to clipboard, switch view to plain text mode 

Defining customwidgetplugin.h

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

implementing customwidgetplugin.cpp

Qt Code:
  1. #include "dateViewList.h"
  2. #include <string>
  3. #include <qstring.h>
  4. #include <qobject.h>
  5. #include <qwidget.h>
  6. #include "customwidgetplugin.h"
  7. #include <QtPlugin>
  8. #include <qstringlist.h>
  9. #include <QListWidget>
  10.  
  11.  
  12.  
  13. extendedListWidgetPlugin :: extendedListWidgetPlugin(QWidget *parent){
  14.  
  15. initialized = false;
  16.  
  17. }
  18.  
  19. void extendedListWidgetPlugin :: initialize(QDesignerFormEditorInterface * /* core */)
  20.  
  21. {
  22. if (initialized)
  23. return;
  24.  
  25. initialized = true;
  26. }
  27.  
  28. QListWidget *extendedListWidgetPlugin :: createWidget(QWidget *parent)
  29. {
  30. return new dateViewList(parent);
  31. }
  32.  
  33.  
  34. bool extendedListWidgetPlugin :: isInitialized() const
  35. {
  36. return initialized;
  37. }
  38.  
  39. QString extendedListWidgetPlugin::name() const
  40. {
  41. return "bikeDateList";
  42. }
  43.  
  44. QString extendedListWidgetPlugin::group() const
  45. {
  46. return "Display Widgets [PLUGINS]";
  47. }
  48.  
  49. QIcon extendedListWidgetPlugin :: icon() const
  50. {
  51. return QIcon("./hart.jpg");
  52. }
  53.  
  54. QString extendedListWidgetPlugin :: toolTip() const
  55. {
  56. return "DateViewList";
  57. }
  58.  
  59. QString extendedListWidgetPlugin :: whatsThis() const
  60. {
  61. return "Special widget for making Calender";
  62. }
  63.  
  64. bool extendedListWidgetPlugin::isContainer() const
  65. {
  66. return true;
  67. }
  68.  
  69. QString extendedListWidgetPlugin :: domXml() const
  70. {
  71. return "<widget class=\"dateViewList\" name=\"bikeDateList\">\n"
  72. " <property name=\"geometry\">\n"
  73. " <rect>\n"
  74. " <x>0</x>\n"
  75. " <y>0</y>\n"
  76. " <width>100</width>\n"
  77. " <height>100</height>\n"
  78. " </rect>\n"
  79. " </property>\n"
  80. " <property name=\"toolTip\" >\n"
  81. " <string>date Holder</string>\n"
  82. " </property>\n"
  83. " <property name=\"whatsThis\" >\n"
  84. " <string>dateViewList holds property of the date "
  85. "and functions to manipulate the list</string>\n"
  86. " </property>\n"
  87. "</widget>\n";
  88. }
  89.  
  90. QString extendedListWidgetPlugin ::includeFile() const
  91. {
  92. return "dateViewList.h";
  93. }
  94.  
  95. Q_EXPORT_PLUGIN2(customwidgetplugin , extendedListWidgetPlugin)
To copy to clipboard, switch view to plain text mode 



I understand i may not be able to set the extra attributes and variables i add to my class in designer but all the standard things like frame and stuff that is present in a ordinary QListWidget should at least be accessible in my plugin.

Anyone familliar with plugins?
ALL thoughts are Welcome exept for ppl loking for telemarket agencies!!

Cheers