Results 1 to 1 of 1

Thread: custom widget: exposing properties of subwidgets

  1. #1
    Join Date
    May 2011
    Posts
    20
    Thanked 3 Times in 3 Posts
    Platforms
    Unix/X11

    Default Re: custom widget: exposing properties of subwidgets

    I have a custom container widget that I designed and created a plugin for it without any issues. The widget I have contains subwidgets that are only visible to the widget that gets shown in the designer. I want to have a Q_Property defined in one of the subwidgets and have it show up in the designer, however this is becoming quite the challenge. Does anyone know how to do this?

    Here is small example of what I am trying to do:

    Qt Code:
    1. class QDESIGNER_WIDGET_EXPORT Container : public QWidget
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. Container(QWidget *aParent = 0);
    7. ~Container();
    8.  
    9. void addPart(QWidget *aPart, QString const &aTitle);
    10. private:
    11. QList<QWidget*> mPartList;
    12. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. class Q_DECL_EXPORT ContainerPart : public QWidget
    2. {
    3. Q_OBJECT
    4. Q_PROPERTY(QString pageTitle READ getPageTitle WRITE setPageTitle)
    5.  
    6. public:
    7. ContainerPart(QWidget *aPage, QWidget *aParent = 0);
    8. ~ContainerPart();
    9.  
    10. QString getPageTitle();
    11. void setPageTitle(QString const &aTitle);
    12.  
    13. protected:
    14. QLabel *mTitle;
    15. QWidget *mPart;
    16.  
    17. };
    To copy to clipboard, switch view to plain text mode 

    Basically I will have a container that contains multiple Parts. I want a way in the designer to set the title for each of the parts. Note that I have no problem displaying the parts in the designer, I just can't get the property in "ContainerPart" to show. I am thinking it may be due to the Q_DECL_EXPORT.


    Added after 10 minutes:


    I am wondering if the problem is with the plugin I wrote. Since this is a container I had to use the QDesignerContainerExtension and the insertWidget function that needs to be implemented requires a QWidget and not a "ContainerPart". Since it only knows what a QWidget is I think that is why it is not displaying the property.
    Last edited by snydesc; 13th February 2012 at 18:24.

Similar Threads

  1. Qt Designer Custom widget properties not showing in Qt Designer
    By nguarracino in forum Qt Tools
    Replies: 1
    Last Post: 19th November 2010, 14:09
  2. Exposing custom widget properties
    By Plixil in forum Newbie
    Replies: 1
    Last Post: 25th July 2010, 16:38
  3. QComboBox Custom Widget has missing designer properties
    By vieraci in forum Qt Programming
    Replies: 5
    Last Post: 9th December 2009, 13:30
  4. Replies: 5
    Last Post: 16th May 2006, 20:38
  5. How to initialize properties to a custom plugin widget?
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 28th February 2006, 16:56

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.