PDA

View Full Version : Property editor doesn't display my custom widget properties



cocheci
16th May 2006, 20:15
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

wysota
16th May 2006, 20:55
Maybe your property handling methods are incorrect? Did you receive any warnings about it during plugin compilation?

cocheci
16th May 2006, 21:09
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

jacek
16th May 2006, 21:14
Do you have Q_OBJECT macro inside your widget definition?

cocheci
16th May 2006, 21:18
Yes, the Q_OBJECT is in there. Would you like me to post the sources?

cocheci
16th May 2006, 21:38
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