Add a hack to ensure the layout anchors work properly on Qt 5.11 and earlier
This commit is contained in:
parent
2d7dcb495c
commit
1d94903eef
2 changed files with 24 additions and 0 deletions
|
|
@ -30,6 +30,18 @@ GridView {
|
||||||
// We do this here instead of onActivated to avoid losing the user's
|
// We do this here instead of onActivated to avoid losing the user's
|
||||||
// selection when backing out of a different page of the app.
|
// selection when backing out of a different page of the app.
|
||||||
currentIndex = -1
|
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: {
|
StackView.onActivated: {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,18 @@ GridView {
|
||||||
// We do this here instead of onActivated to avoid losing the user's
|
// We do this here instead of onActivated to avoid losing the user's
|
||||||
// selection when backing out of a different page of the app.
|
// selection when backing out of a different page of the app.
|
||||||
currentIndex = -1
|
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: {
|
StackView.onActivated: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue