簡體   English   中英

如何使此GridView出現在窗口的中央?

[英]How can I get this GridView to appear in the center of my Window?

我現在正停留在此QML項目上。 這是一個簡單的2x3網格,似乎一直滯留在屏幕的左側。 如果我應用anchors.centerIn: parent ,則它使GridView居中,但忽略了我的TopMargin屬性。 如果能在這方面得到任何幫助,將不勝感激。 我知道我可以應用leftMargin:,但是有點難看。

GridView {

    id: gridView
    interactive: false
    clip: true

    // anchors.centerIn: parent
    anchors.left: parent.left
    anchors.top: titleBarContainer.bottom
    anchors.topMargin: 20
    anchors.right: parent.right

    width: 400
    height: parent.height

    currentIndex: -1

    cellWidth: 200
    cellHeight: 200
...

anchors.top: titleBarContainer.bottom
anchors.topMargin: 20
anchors.horizontalCenter: parent.horizontalCenter

width: 400
height: parent.height

...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM