0
我有被設計來顯示的圖像與一些文本下它如下一個簡單的組件:QML不居中部件
Rectangle{
id: functionView
RowLayout {
spacing: 350
anchors.centerIn: parent
Item {
Image {
id: upload_pic
source: "http://icons.iconarchive.com/icons/custom-icon-design/mono-general-4/128/upload-icon.png"
Text {
text: "Upload Images"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: -20
}
}
Layout.fillWidth: true
}
Item {
Image {
id: workflow_pic
source: "http://icons.iconarchive.com/icons/icons8/windows-8/128/Data-Workflow-icon.png"
Text {
text: "Upload Workflow"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: -20
}
}
Layout.fillWidth: true
}
}
}
然而,這是不對齊的(水平或垂直)組件窗口。這可以使用qmlscene
進行驗證。圖像直接鏈接到組件源中。
此,不幸的是,沒有爲我工作。 – Luca
您需要爲高度做同樣的事情。設置矩形的'anchors.fill:parent' – derM