Results 1 to 9 of 9

Thread: Managing widget plugin in Qt Designer

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default 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

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Managing widget plugin in Qt Designer

    can you post your QWidgetPlugin subclass implementation?

  3. #3
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Managing widget plugin in Qt Designer

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

  4. #4
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default 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 ?

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Managing widget plugin in Qt Designer

    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.

    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.

  6. #6
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default [SOLVE] Re: Managing widget plugin in Qt Designer

    Ok, it works

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Managing widget plugin in Qt Designer

    Would you mind sharing what was the problem and the solution?

  8. #8
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default 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.

  9. #9
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. Replies: 4
    Last Post: 9th August 2007, 09:20
  2. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 15:13
  3. Replies: 1
    Last Post: 22nd January 2007, 13:13
  4. Replies: 13
    Last Post: 15th December 2006, 12:52
  5. Size of a plugin widget in designer
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2006, 14:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.