In my publisher-subscriber class the Qt components subscribe by their property names. The publisher maps the pairs <QObject*,PropertyName (as QString)>
to the names of the publishable variables.
{ VarName -> [(QObject*, PropName)] }
On variable change, the list of subscribed QObjects are called using setProperty:
subscriber->setProperty( PropName.toAscii().constData(), NewValue );
I'd like to optimize the conversion from QString to char*. Also I assume, internally in setProperty the property setter function is found by going through the list of const* and string compare.
QMetaObject provides the method:
int QMetaObject::indexOfProperty(const char *name) const
which I could use during the subscription to get the index and later on the value change use only Index instead of the string-name.
But how can I invoke the property setter by the index? Is it possible at all?