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

Anchoring childs in window element problem

$
0
0
Hello everyone, Finally got my self learning QML, and got stuck when following this tutorial: Qt Quick Application Developer Guide for Desktop [download.qt-project.org] Probably it’s something simple, but I can’t seem to spot it. My top level item is Window item, and when I place my other elements inside it and anchor it, the width of the Window element is only the width of the items placed inside. It does work if my top level item is a Rectangle, and I use QQuickView instead of QQmlApplicationEngine. Am I missing some fundamental behavior of Window element? Here is the Window output: And here is Rectangle output, the one I want for my window element: Here is the code: import QtQuick 2.2 import QtQuick.Window 2.1   Window {     id: window     visible: true     width: 800     height: 600     title: "WHY YOU NOT WORKING"         MarkerPanel {         id:markerPanel         width: 50         anchors.topMargin: 20         anchors {             right: window.right             top: window.top             bottom: window.bottom         }     }       Rectangle {         id: toolbar         width:50         color: "#444a4b"           anchors {             left: window.left             top: window.top             bottom: window.bottom             topMargin: 100; bottomMargin: 100         }           Column {             anchors.fill: parent             anchors.topMargin: 30             spacing: 20               Repeater {                 model: 2                 Rectangle {                     width: 50                     height: 50                     color: "red"                 }             }         }     } } Also I tried placing the MarkerPanel and the inner Rectangle in a an item, which had property anchors.fill: parent set. Didn’t work either. Thanks

Viewing all articles
Browse latest Browse all 4972

Trending Articles