@@ -2,7 +2,7 @@ import QtQuick
22import QtQuick.Controls
33import QtQuick.Layouts
44import QtQml.Models
5- import Qt.labs.qmlmodels 1.0
5+ import Qt.labs.qmlmodels
66
77import Controls 1.0
88import MaterialIcons 2.2
@@ -75,6 +75,11 @@ Panel {
7575 }
7676
7777 function populate_model () {
78+ if (! intrinsicModel .ready ) {
79+ // If the TableModel is not done being instantiated, do nothing
80+ return
81+ }
82+
7883 intrinsicModel .clear ()
7984 for (var intr in parsedIntrinsic) {
8085 intrinsicModel .appendRow (parsedIntrinsic[intr])
@@ -552,8 +557,10 @@ Panel {
552557 anchors .fill : parent
553558 boundsMovement : Flickable .StopAtBounds
554559
555- // Provide width for column
556- // Note no size provided for the last column (bool comp) so it uses its automated size
560+ palette: root .palette
561+
562+ // Provide width for column
563+ // Note no size provided for the last column (bool comp) so it uses its automated size
557564 columnWidthProvider : function (column ) { return intrinsicModel .columnWidths [column] }
558565
559566 model: intrinsicModel
@@ -569,6 +576,8 @@ Panel {
569576
570577 TableModel {
571578 id : intrinsicModel
579+ property bool ready: false
580+
572581 // Hardcoded default width per column
573582 property var columnWidths: [105 , 75 , 75 , 75 , 60 , 60 , 60 , 60 , 200 , 60 , 60 , 60 ]
574583 property var columnNames: [
@@ -599,6 +608,13 @@ Panel {
599608 TableModelColumn { display : function (modelIndex ){return parsedIntrinsic[modelIndex .row ][intrinsicModel .columnNames [10 ]]} }
600609 TableModelColumn { display : function (modelIndex ){return parsedIntrinsic[modelIndex .row ][intrinsicModel .columnNames [11 ]]} }
601610 // https://doc.qt.io/qt-5/qml-qt-labs-qmlmodels-tablemodel.html#appendRow-method
611+
612+ Component .onCompleted : {
613+ ready = true
614+ // Triggers "populate_model" in case the intrinsics have been filled while the model was
615+ // being instantiated
616+ root .populate_model ()
617+ }
602618 }
603619
604620 // CODE FOR HEADERS
0 commit comments