Dynamically loaded QML-file in Tab will only be executed when Tab is shown

731 views Asked by At

I'm creating Tabs in a TabView dynamically via

var component = Qt.createComponent("file://tabcontent.qml"));
tabView.addTab(component);

However their code is not executed before I click on the Tab itself. How can I solve this?

1

There are 1 answers

0
jturcotte On BEST ANSWER

The created Tab inherits from Loader with its active property set to false until the Tab is clicked. Just explicitly set the active property after creating it:

var component = Qt.createComponent("file://tabcontent.qml'));
var tab = tabView.addTab(component);
tab.active = true;