1

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?

BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
Hedge
  • 16,142
  • 42
  • 141
  • 246

1 Answers1

4

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;
BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
jturcotte
  • 1,273
  • 9
  • 9