Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Q_PROPERTY in Qt?

I cant really figure out why do I need it, Been reading: http://doc.qt.io/qt-4.8/properties.html#requirements-for-declaring-properties

still cant really understand the use of it. any kind of help would be great!

like image 298
snoofkin Avatar asked Feb 02 '23 22:02

snoofkin


1 Answers

Read about the Qt Property System , this is just like a usual class method but it can be used with Qt's meta-object system:

 QPushButton *button = new QPushButton;
 QObject *object = button;

 button->setDown(true);
 object->setProperty("down", true);

Also these properties will be visible under Qt Designer too so you could create a custom widget with some properties and hook it up in Qt Designer, see this article for details.

like image 131
ismail Avatar answered Feb 05 '23 16:02

ismail