PDA

View Full Version : How to use property name in every class



GAURAV PANT
14th March 2014, 03:03
Hi
I have two issues:
1. I have created a property name using QProperty but i am unable to access this property name in the same class and other classes.
2. Although using setter function the value of property get set but is this possible that i write property name=somevalue and automatically setter function is called
Thanks.

ChrisW67
14th March 2014, 06:19
1. We have no idea what your code is doing or trying to do.

2. No. If you want to set the property then either call the setter on an instance of the specific class or use the generic QObject::setProperty() function on a QObject instance.

anda_skoa
14th March 2014, 07:55
2. Although using setter function the value of property get set but is this possible that i write property name=somevalue and automatically setter function is called

Additional to what ChrisW67 wrote: if the object is exported to QML or instantiated from QML then yes.

Cheers,
_