Results 1 to 4 of 4

Thread: Custom widget not visible in Integrated designer of Qt Creator

  1. #1
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Custom widget not visible in Integrated designer of Qt Creator

    Hi

    I made a custom widget plugin based on the custom widgets example ( using AnalogClock ) provided in Qt Assistant. I changed the name of the plugin class to MyPlugin and the name of the AnalogClock class to MyClock.

    I then added libMyPlugin.so to the ../plugins/designer folder. When I check the "Plugin information" pop up from Tools->Form Editor->About Qt Designer plugins,
    I can see that my plugin information has been loaded. But the plugin / widget is not visible in Qt Designer. It was supposed to be added to the group "Display widgets [Examples]".

    Can someone tell me how to add this to designer or how do I use this widget in my form ? I tried restarting Qt creator and promoting a placeholder widget to no avail.

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Custom widget not visible in Integrated designer of Qt Creator

    Quote Originally Posted by John82 View Post
    Can someone tell me how to add this to designer or how do I use this widget in my form ? I tried restarting Qt creator and promoting a placeholder widget to no avail.
    There could be many reasons for this.
    1. Your plugin is not properly exported, please refer the code of Analog clock for example.
    2. In doXML function of your plugin class, try to change the group and other properties.

  3. The following user says thank you to yogeshgokul for this useful post:

    John82 (17th November 2009)

  4. #3
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom widget not visible in Integrated designer of Qt Creator

    Quote Originally Posted by yogeshgokul View Post
    There could be many reasons for this.
    1. Your plugin is not properly exported, please refer the code of Analog clock for example.
    -- If the plugin is not exported properly, Does it still show up in the plugin information ?

    2. In doXML function of your plugin class, try to change the group and other properties.
    -- I commented out this section to return only a simple string. I will see if that was causing the problem.

  5. #4
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Custom widget not visible in Integrated designer of Qt Creator

    Yup! It was because I had commented out the code in domXml (). The plugin became visible. After this there was a small problem because because the actual widget itself wasn't displayed when I dropped it into a form. In the terminal, I got this message :
    Designer: The class attribute for the class MyClock does not match the class name NewPlugin.
    Designer: A class name mismatch occurred when creating a widget using the custom widget factory registered for widgets of class NewPlugin. It returned a widget of class MyClock.
    I went through the code again and realized that the name () was returning the name of the plugin class rather than the widget class. I changed this and everything started working properly. Thanks!

Similar Threads

  1. Cannot add custom widget to Qt Creator
    By djogon in forum Qt Tools
    Replies: 5
    Last Post: 30th April 2010, 10:15
  2. Custom widget - Only works in Designer
    By Darhuuk in forum Qt Tools
    Replies: 6
    Last Post: 8th January 2008, 00:46
  3. Replies: 4
    Last Post: 24th March 2006, 22:50
  4. Replies: 4
    Last Post: 1st March 2006, 23:11
  5. Replies: 4
    Last Post: 6th February 2006, 14:30

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.