Reputation: 4089
I have managed to change the "color" property of QML text with C++ using this:
theText->setProperty("color", "red");
but if I try
theText->setProperty("font.pointSize", 20);
then nothing happens(it's not that size), I've tried this with other things that include a "." but none seem to work, I think the "." may be part of the problem. I'd really appreciate if someone could help me change the QML font size using C++.
Upvotes: 3
Views: 1540
Reputation: 5781
Look for actual property name. And as far as i know there is no sub-properties in QObjects... So you need something like this:
QFont f = theText->property("font").value<QFont>();
f.setPointSize(20);
theText->setProperty("font",f);
Upvotes: 6