【发布时间】:2016-02-27 23:01:41
【问题描述】:
在ScrollView 中将 QML 对象居中时遇到问题。我想滚动图像和其他 QML 元素,它们应该居中。但它们总是粘在左上角。
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Window 2.0
ApplicationWindow{
id: appWindow
width:Screen.width
height:Screen.height
visible: true
ScrollView {
anchors.fill: parent
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 800
height: 800
color : "yellow"
}
}
}
【问题讨论】:
标签: qml scrollview qt5 rectangles center-align