mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-06 04:17:29 +02:00
Fix Toolbar vertical position
This commit is contained in:
parent
fffd4eec41
commit
60d53359bb
2 changed files with 37 additions and 3 deletions
|
@ -36,6 +36,29 @@ OriginalDesktop.Desktop {
|
|||
}
|
||||
}
|
||||
|
||||
onHeightChanged: {
|
||||
if (height > 100) {
|
||||
adjustToolbarPosition();
|
||||
}
|
||||
}
|
||||
|
||||
function adjustToolbarPosition() {
|
||||
var toolbar = getToolbar("com.highfidelity.interface.toolbar.system")
|
||||
// check if Y position was changed, if toolbar height is assigned etc
|
||||
// default position is adjusted to border width
|
||||
var toolbarY = toolbar.settings.y > 6 ?
|
||||
toolbar.settings.y :
|
||||
desktop.height - (toolbar.height > 0 ? toolbar.height : 50) - 56
|
||||
|
||||
if (toolbar.settings.desktopHeight > 100 && desktop.height !== toolbar.settings.desktopHeight) {
|
||||
toolbarY += desktop.height - toolbar.settings.desktopHeight
|
||||
}
|
||||
|
||||
toolbar.y = toolbarY
|
||||
toolbar.settings.y = toolbarY
|
||||
toolbar.settings.desktopHeight = desktop.height
|
||||
}
|
||||
|
||||
Component { id: toolbarBuilder; Toolbar { } }
|
||||
// This used to create sysToolbar dynamically with a call to getToolbar() within onCompleted.
|
||||
// Beginning with QT 5.6, this stopped working, as anything added to toolbars too early got
|
||||
|
@ -47,7 +70,6 @@ OriginalDesktop.Desktop {
|
|||
anchors.horizontalCenter: settings.constrainToolbarToCenterX ? desktop.horizontalCenter : undefined;
|
||||
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
|
||||
x: sysToolbar.x
|
||||
y: desktop.height - sysToolbar.height - 50
|
||||
buttonModel: tablet.buttons;
|
||||
shown: tablet.toolbarMode;
|
||||
}
|
||||
|
|
|
@ -25,12 +25,24 @@ Window {
|
|||
property bool horizontal: true
|
||||
property real buttonSize: 50;
|
||||
|
||||
property alias settings: settings
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
category: "toolbar/" + window.objectName
|
||||
property alias x: window.x
|
||||
property alias y: window.y
|
||||
property real y: 0
|
||||
property real desktopHeight: 0 //placeholder for desktop height
|
||||
}
|
||||
|
||||
|
||||
onYChanged: {
|
||||
//check if Y changed not due to Desktop size changed. ie. mouse manipulations
|
||||
//otherwise it will be save by Desktop
|
||||
if (desktop.height > 100 && desktop.height === settings.desktopHeight) {
|
||||
settings.y = window.y
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: buttonComponent
|
||||
ToolbarButton {
|
||||
|
|
Loading…
Reference in a new issue