mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-21 23:50:26 +00:00
Add a hack to ensure the layout anchors work properly on Qt 5.11 and earlier
This commit is contained in:
@@ -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: {
|
||||||
|
|||||||
Reference in New Issue
Block a user