PDA

View Full Version : File dialog for custom widget property?



TheJim01
26th April 2010, 15:32
I have a standard custom widget/plug-in, fresh out of the "New Project wizard" in Creator. I added some properties from enumerated types, compiled, and moved the plug-in to Designer--works great.

Now, I want to add an image, and want the user to be able to select the image with designer. Essentially, I want to know how to get a property field like that of the windowIcon property for a QMainWindow. Best-case, it should select either a file or a resource and draw it to the custom widget. But at the very least, I'd like to be able to select a path to the image, even if it doesn't get drawn in designer.

I tried by configuring a QImage member to have its own Q_PROPERTY entry. That didn't work, and didn't even add the property to the list in Designer. I added "DESIGNABLE true" to force it into Designer, with the same result--the property still isn't in the list. I looked at how to expose the properties through the doXML() function, but from my interpretation, that function is used to set default properties, not define which are visible in which way (correct me if I'm wrong).

Is the file dialog functionality only available to QIcon, or am I looking at it the wrong way?

axeljaeger
6th May 2010, 10:14
Did you also tried QPixmap?