QML reference by id. When works and when does not
-
Hello, guys
Following the two code examples. First shows working code and Second where we writestyle: comboBoxStyleId
shows not working code. Why when referencing by element's id we get error?//first ComboBox { id: combo anchors.centerIn: parent width: 200 model: [ "Banana", "Apple", "Coconut" ] style: ComboBoxStyle { id: comboBox background: Rectangle { id: rectCategory radius: 5 border.width: 2 color: "#fff" } }
//second ComboBox { id: combo anchors.centerIn: parent width: 200 model: [ "Banana", "Apple", "Coconut" ] style: comboBoxStyleId ComboBoxStyle { id: comboBoxStyleId background: Rectangle { id: rectCategory radius: 5 border.width: 2 color: "#fff" } }
-
-
@p3c0 thx, but I still do not understand why id reference to component does not work (
-
@Kofr Since it requires
Component
and thusComponent
'sid
will work.