PDA

View Full Version : Qpixmaps and Q_Properties



tescrin
30th July 2012, 23:14
I'm looking to add pixmaps via Q_PROPERTIES. I notice that QPushButton (and similar) have nice little browsing capabilities for finding the file. I'm curious how to get that functionality with my custom widgets.

I've thought of a few ideas:
Q_PROPERTY(QString... [where the user could see the path they've typed in, and the path is saved for use]
Q_PROPERTY(QPixmap...
etc..

but I'm not sure. Theirs displays a pixmap after you've selected/browsed for a resource/file AND displays the location. Near as I can tell these will only accomplish one or the other; and further I doubt it'll add the browsing functionality I'm speaking of.

It may help to mention how the code-generation feature knows what code to generate. If I know this much I may be able to customize that code to my liking.

StrikeByte
31st July 2012, 16:05
This is the code that the QAbstractButton uses:


Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
public:
void setIcon(const QIcon &icon);
QIcon icon() const;

tescrin
31st July 2012, 16:49
Thanks! I was looking for that in their code but must've missed it somehow. I'll head back and keep looking.