mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 14:56:23 +02:00
centered toolbar
This commit is contained in:
parent
56b3ac8c89
commit
90ebbb79c1
2 changed files with 19 additions and 8 deletions
|
@ -51,27 +51,35 @@ OriginalDesktop.Desktop {
|
||||||
Toolbar {
|
Toolbar {
|
||||||
id: sysToolbar;
|
id: sysToolbar;
|
||||||
objectName: "com.highfidelity.interface.toolbar.system";
|
objectName: "com.highfidelity.interface.toolbar.system";
|
||||||
// These values will be overridden by sysToolbar.x/y if there is a saved position in Settings
|
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings.
|
||||||
// On exit, the sysToolbar position is saved to settings
|
x: settings.firstRun ? (desktop.width - sysToolbar.width) / 2 : sysToolbar.x;
|
||||||
x: 30
|
|
||||||
y: 50
|
y: 50
|
||||||
}
|
}
|
||||||
property var toolbars: (function (map) { // answer dictionary preloaded with sysToolbar
|
property var toolbars: (function (map) { // answer dictionary preloaded with sysToolbar
|
||||||
map[sysToolbar.objectName] = sysToolbar;
|
map[sysToolbar.objectName] = sysToolbar;
|
||||||
return map; })({});
|
return map; })({});
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settings
|
||||||
|
property bool firstRun: true
|
||||||
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
WebEngine.settings.javascriptCanOpenWindows = true;
|
WebEngine.settings.javascriptCanOpenWindows = true;
|
||||||
WebEngine.settings.javascriptCanAccessClipboard = false;
|
WebEngine.settings.javascriptCanAccessClipboard = false;
|
||||||
WebEngine.settings.spatialNavigationEnabled = false;
|
WebEngine.settings.spatialNavigationEnabled = false;
|
||||||
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
||||||
|
|
||||||
var toggleHudButton = sysToolbar.addButton({
|
[ // Allocate the standard buttons in the correct order. They will get images, etc., via scripts.
|
||||||
objectName: "hudToggle",
|
"hmdToggle", "mute", "mod", "help",
|
||||||
imageURL: "../../../icons/hud.svg",
|
"hudToggle",
|
||||||
visible: true,
|
"com.highfidelity.interface.system.editButton", "marketplace", "snapshot", "goto"
|
||||||
pinned: true,
|
].forEach(function (name) {
|
||||||
|
sysToolbar.addButton({objectName: name});
|
||||||
});
|
});
|
||||||
|
var toggleHudButton = sysToolbar.findButton("hudToggle");
|
||||||
|
toggleHudButton.imageURL = "../../../icons/hud.svg";
|
||||||
|
toggleHudButton.pinned = true;
|
||||||
|
sysToolbar.updatePinned(); // automatic when adding buttons only IFF button is pinned at creation.
|
||||||
|
|
||||||
toggleHudButton.buttonState = Qt.binding(function(){
|
toggleHudButton.buttonState = Qt.binding(function(){
|
||||||
return desktop.pinned ? 1 : 0
|
return desktop.pinned ? 1 : 0
|
||||||
|
|
|
@ -114,6 +114,9 @@ Window {
|
||||||
// and allow scripts to be idempotent so they don't duplicate buttons if they're reloaded
|
// and allow scripts to be idempotent so they don't duplicate buttons if they're reloaded
|
||||||
var result = findButton(properties.objectName);
|
var result = findButton(properties.objectName);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
for (var property in properties) {
|
||||||
|
result[property] = properties[property];
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
properties.toolbar = this;
|
properties.toolbar = this;
|
||||||
|
|
Loading…
Reference in a new issue