mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-17 22:08:27 +02:00
tell desktop about preference changes
This commit is contained in:
parent
6aad78c8e8
commit
3a072b5bf9
4 changed files with 19 additions and 5 deletions
|
@ -51,19 +51,24 @@ OriginalDesktop.Desktop {
|
|||
Toolbar {
|
||||
id: sysToolbar;
|
||||
objectName: "com.highfidelity.interface.toolbar.system";
|
||||
anchors.horizontalCenter: settings.systemToolbarHorizontalConstraint ? desktop.horizontalCenter : undefined;
|
||||
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: 50
|
||||
}
|
||||
Settings {
|
||||
id: settings;
|
||||
category: "toolbar";
|
||||
property bool constrainToolbarToCenterX: true;
|
||||
}
|
||||
function setConstrainToolbarToCenterX(constrain) { // Learn about c++ preference change.
|
||||
settings.constrainToolbarToCenterX = constrain;
|
||||
}
|
||||
property var toolbars: (function (map) { // answer dictionary preloaded with sysToolbar
|
||||
map[sysToolbar.objectName] = sysToolbar;
|
||||
return map; })({});
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
property bool systemToolbarHorizontalConstraint: true
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
WebEngine.settings.javascriptCanOpenWindows = true;
|
||||
WebEngine.settings.javascriptCanAccessClipboard = false;
|
||||
|
|
|
@ -2153,6 +2153,7 @@ void Application::setFieldOfView(float fov) {
|
|||
|
||||
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
||||
_constrainToolbarPosition.set(setting);
|
||||
DependencyManager::get<OffscreenUi>()->setConstrainToolbarToCenterX(setting);
|
||||
}
|
||||
|
||||
void Application::aboutApp() {
|
||||
|
|
|
@ -371,6 +371,13 @@ void OffscreenUi::setPinned(bool pinned) {
|
|||
}
|
||||
}
|
||||
|
||||
void OffscreenUi::setConstrainToolbarToCenterX(bool constrained) {
|
||||
bool invokeResult = QMetaObject::invokeMethod(_desktop, "setConstrainToolbarToCenterX", Q_ARG(QVariant, constrained));
|
||||
if (!invokeResult) {
|
||||
qWarning() << "Failed to set toolbar constraint";
|
||||
}
|
||||
}
|
||||
|
||||
void OffscreenUi::addMenuInitializer(std::function<void(VrMenu*)> f) {
|
||||
if (!_vrMenu) {
|
||||
_queuedMenuInitializers.push_back(f);
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
void setPinned(bool pinned = true);
|
||||
|
||||
void togglePinned();
|
||||
void setConstrainToolbarToCenterX(bool constrained);
|
||||
|
||||
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||
void addMenuInitializer(std::function<void(VrMenu*)> f);
|
||||
|
|
Loading…
Reference in a new issue