我怎样才能让这个 GridView 出现在我的 Window 的中心?

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

...