OK, I found a problem for my case.
I used Qt.createQmlObject()
as follow:
import QtQuick 2.2;
Rectangle {
id: root
width: 300; height: 300
Row {
id: itemContainer
Component.onCompleted: {
var newObject = Qt.createQmlObject('import QtQuick 2.2; Rectangle {color: "red"; width: 200; height: 200}', itemContainer, "");
}
Rectangle {
width: 100; height: 50
color: "Yellow"
}
}
}
This not works and I changed it as follow:
import QtQuick 2.2;
Rectangle {
id: root
width: 300; height: 300
Row {
id: itemContainer
Rectangle {
width: 100; height: 50
color: "Yellow"
}
Component.onCompleted: {
var newObject = Qt.createQmlObject('import QtQuick 2.2; Rectangle {color: "red"; width: 200; height: 200}', itemContainer, "");
}
}
}
and it WORKS, but not as expected! As you can see, executing Qt.createQmlObject()
inside a Row
element not causes to recalculation of some of essential estimations of Row
element.
I reported this as bug in https://bugreports.qt-project.org/browse/QTBUG-40356