Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

RowLayout doesn't support dynamic item insertion?

$
0
0
RowLayout does not support dynamic item insertion? I expect two rectangles can been seen inside RowLayout. RowLayout works fine when two rectangles are created statically. However, RowLayout doesn’t work properly when two rectangles are created dynamically. Two rectangles are overlapped. static approach import QtQuick 2.0 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.0   Rectangle {     height: 640     width: 2*640 + 40       RowLayout {         id: rowLayout         anchors.fill: parent         spacing: 10         Rectangle {             height: parent.height             width: parent.height             color: "red"         }           Rectangle {             height: parent.height             width: parent.height             color: "blue"         }     } } dynamic approach import QtQuick 2.0 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.0   Rectangle {     height: 640     width: 2*640 + 40     Component {         id: rect         Rectangle {             height: parent.height             width: parent.height         }     }       RowLayout {         id: rowLayout         anchors.fill: parent         spacing: 10     }       Component.onCompleted: {         rect.createObject(rowLayout,{"color":"red"});         rect.createObject(rowLayout,{"color":"blue"});     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles