Create Font object in QML function
-
wrote on 12 Mar 2017, 17:32 last edited by
Hi all,
I need to create a Font object inside a QML function and then pass it to C++ using signal:signal mySignal(font my_font) function myFunction() { Font font = new Font() (?????) ... ... mySignal(font) }
is it possibile?
Thanks
-
wrote on 12 Mar 2017, 18:05 last edited by
Yes, it's possible.
font
is a QML basic type, see font QML Basic Type. But you don't usenew
to create an instance, but the factory functionQt.font()
, see font method. -
Yes, it's possible.
font
is a QML basic type, see font QML Basic Type. But you don't usenew
to create an instance, but the factory functionQt.font()
, see font method.wrote on 12 Mar 2017, 22:13 last edited by@Wieland Thanks!
I solved in this way:signal mySignal(font my_font) function myFunction() { var my_font = Qt.font({family: "Sans Serif", pointSize: 32}) .... mySignal(my_font) }
1/3