I've created a new project and added a scrollview with a rectangle. When I start the project the rectangle is not displayed but if I add an other control it appears. I'm not sure what I'm doing wrong, I want to see the rectangle always.
import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
id: mainWindow
ScrollView{
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 0
anchors.bottomMargin: 0
width: 289
Rectangle{
anchors.fill: parent
color: "blue"
MouseArea
{
anchors.fill: parent
onClicked: console.log("Click")
}
}
}
}
With this code I get the following window (rectangle is not visible):
However if I add a button to this ScrollView...
ScrollView{
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 0
anchors.bottomMargin: 0
width: 289
Rectangle{
anchors.fill: parent
color: "blue"
MouseArea
{
anchors.fill: parent
onClicked: console.log("Click")
}
}
Button{
text:"Test"
}
}
What's wrong with my first code (without the button)?