Add a hack to ensure the layout anchors work properly on Qt 5.11 and earlier

This commit is contained in:
Cameron Gutman
2019-03-30 12:28:18 -07:00
parent 2d7dcb495c
commit 1d94903eef
2 changed files with 24 additions and 0 deletions

View File

@@ -30,6 +30,18 @@ GridView {
// We do this here instead of onActivated to avoid losing the user's
// selection when backing out of a different page of the app.
currentIndex = -1
// HACK: If this is not Qt 5.12 (which has synchronousDrag),
// set anchors on creation. This will cause an anchor conflict
// with the parent StackView which breaks animation, but otherwise
// the grid will not be centered in the window.
if (this.synchronousDrag === undefined) {
anchors.fill = parent
anchors.leftMargin = leftMargin
anchors.rightMargin = rightMargin
anchors.topMargin = topMargin
anchors.bottomMargin = bottomMargin
}
}
StackView.onActivated: {