Qt Quick Controls 2 hangs when overwriting Button.qml -
i'm trying implement own style , want override built-in objects. here's i'm doing:
// main.cpp qquickstyle::setstyle("mystyle");
and
// mystyle/button.qml import qtquick 2.5 import qtquick.controls 2.1 controls controls.button { background: rectangle { color: "green" } }
and
// qml.qrc <rcc> <qresource prefix="/"> <file>main.qml</file> <file>mystyle/checkbox.qml</file> </qresource> </rcc>
according docs believe should work automagically using file selectors.
however, app hangs on startup. guess fall recursive import. how do correctly?
the qt quick controls 2 styling system based on qml type registration. when run app mystyle, type known qtquick.controls.button is mystyle/button.qml
. therefore mystyle/button.qml
cannot inherit qtquick.controls.button. cannot inherit itself.
this same writing following c++:
// button.h #include "button.h" class button : public button {};
a bit radicalized, easy understand analogy. :)
what can have (my)button.qml
somewhere, let inherit qtquick.controls.button, , don't register qt quick controls 2 import folder. call "customizing qt quick controls 2".
Comments
Post a Comment