Results 1 to 6 of 6

Thread: Property editor doesn't display my custom widget properties

  1. #1
    Join Date
    May 2006
    Posts
    16
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Property editor doesn't display my custom widget properties

    Hello,

    I have created a custom widget and a plugin for it, so it shows up fine in designer. I have also added a couple of properties using the Q_PROPERTY macro. The problem is that these properties do not show up in the property editor when I click on my custom widget in designer. I am using Qt 4.1.2 on linux. Does anyone know how I can make the properties show up in the property editor?

    Thanks,
    Cristian

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Property editor doesn't display my custom widget properties

    Maybe your property handling methods are incorrect? Did you receive any warnings about it during plugin compilation?

  3. #3
    Join Date
    May 2006
    Posts
    16
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Property editor doesn't display my custom widget properties

    No warnings. In fact, the property handling methods (and the properties themselves) are as simple as this:

    Q_PROPERTY(int minimum READ minimum WRITE set_minimum)
    Q_PROPERTY(int maximum READ maximum WRITE set_maximum)

    int minimum() const;
    int maximum() const;

    void set_minimum(int min);
    void set_maximum(int max);


    Thanks,
    Cristian

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Property editor doesn't display my custom widget properties

    Do you have Q_OBJECT macro inside your widget definition?

  5. #5
    Join Date
    May 2006
    Posts
    16
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Property editor doesn't display my custom widget properties

    Yes, the Q_OBJECT is in there. Would you like me to post the sources?

  6. #6
    Join Date
    May 2006
    Posts
    16
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Property editor doesn't display my custom widget properties

    OK, here's the (silly) thing I was doing:

    I had a previous version of the shared library containing the custom widget that I did not remove from the $QTDIR/plugins/designer directory. I didn't want to lose it, so I just renamed it (Duh!!). I guess designer was loading my plugin from that old ".so" and was ignoring the new one that contained the properties.

    Sorry for the confusion and thanks for the replies.

    Cristian

Similar Threads

  1. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  2. Replies: 3
    Last Post: 12th April 2006, 08:20
  3. 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.