mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-17 07:40:56 +02:00
commit
03b8b97d36
4 changed files with 53 additions and 38 deletions
43
interface/resources/qml/controls-uit/QueuedButton.qml
Normal file
43
interface/resources/qml/controls-uit/QueuedButton.qml
Normal file
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// QueuedButton.qml
|
||||
// -- original Button.qml + signal timer workaround --ht
|
||||
// Created by David Rowe on 16 Feb 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4 as Original
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import "../styles-uit"
|
||||
import "." as HifiControls
|
||||
|
||||
HifiControls.Button {
|
||||
// FIXME: THIS WORKAROUND MIGRATED/CONSOLIDATED FROM RUNNINGSCRIPTS.QML
|
||||
|
||||
// For some reason trigginer an API that enters
|
||||
// an internal event loop directly from the button clicked
|
||||
// trigger below causes the appliction to behave oddly.
|
||||
// Most likely because the button onClicked handling is never
|
||||
// completed until the function returns.
|
||||
// FIXME find a better way of handling the input dialogs that
|
||||
// doesn't trigger this.
|
||||
|
||||
// NOTE: dialogs that need to use this workaround can connect via
|
||||
// onQueuedClicked: ...
|
||||
// instead of:
|
||||
// onClicked: ...
|
||||
|
||||
signal clickedQueued()
|
||||
Timer {
|
||||
id: fromTimer
|
||||
interval: 5
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: clickedQueued()
|
||||
}
|
||||
onClicked: fromTimer.running = true
|
||||
}
|
|
@ -75,7 +75,7 @@ Preference {
|
|||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
|
||||
Button {
|
||||
QueuedButton {
|
||||
id: bookmarkAvatarButton
|
||||
text: "Bookmark Avatar"
|
||||
width: 140
|
||||
|
@ -84,7 +84,7 @@ Preference {
|
|||
bottom: parent.bottom
|
||||
rightMargin: hifi.dimensions.contentSpacing.x
|
||||
}
|
||||
onClicked: root.bookmarkAvatarSignal()
|
||||
onClickedQueued: avatarBookmarks.addBookmark()
|
||||
}
|
||||
|
||||
Button {
|
||||
|
|
|
@ -219,41 +219,18 @@ ScrollingWindow {
|
|||
Row {
|
||||
spacing: hifi.dimensions.contentSpacing.x
|
||||
|
||||
HifiControls.Button {
|
||||
HifiControls.QueuedButton {
|
||||
text: "from URL"
|
||||
color: hifi.buttons.black
|
||||
height: 26
|
||||
onClicked: fromUrlTimer.running = true
|
||||
|
||||
// For some reason trigginer an API that enters
|
||||
// an internal event loop directly from the button clicked
|
||||
// trigger below causes the appliction to behave oddly.
|
||||
// Most likely because the button onClicked handling is never
|
||||
// completed until the function returns.
|
||||
// FIXME find a better way of handling the input dialogs that
|
||||
// doesn't trigger this.
|
||||
Timer {
|
||||
id: fromUrlTimer
|
||||
interval: 5
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: ApplicationInterface.loadScriptURLDialog();
|
||||
}
|
||||
onClickedQueued: ApplicationInterface.loadScriptURLDialog()
|
||||
}
|
||||
|
||||
HifiControls.Button {
|
||||
HifiControls.QueuedButton {
|
||||
text: "from Disk"
|
||||
color: hifi.buttons.black
|
||||
height: 26
|
||||
onClicked: fromDiskTimer.running = true
|
||||
|
||||
Timer {
|
||||
id: fromDiskTimer
|
||||
interval: 5
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: ApplicationInterface.loadDialog();
|
||||
}
|
||||
onClickedQueued: ApplicationInterface.loadDialog()
|
||||
}
|
||||
|
||||
HifiControls.Button {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <Application.h>
|
||||
#include <OffscreenUi.h>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "Menu.h"
|
||||
|
@ -46,15 +47,9 @@ void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
|
|||
// the OffscreenUi doesn't seem available this early to recurse through to find the root object where the signal is declared
|
||||
// I've added a delay for now
|
||||
|
||||
// The OffscreenUi also doesn't create the object until it is shown first, so I'm forcing it to show so the object exists
|
||||
QTimer::singleShot(2000, [&] {
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
offscreenUi->show(QString("hifi/dialogs/AvatarPreferencesDialog.qml"), "AvatarPreferencesDialog");
|
||||
auto bookmarkAvatarButton = offscreenUi->getRootItem()->findChild<QQuickItem*>("avatarPreferencesRoot");
|
||||
if (bookmarkAvatarButton) {
|
||||
QObject::connect(bookmarkAvatarButton, SIGNAL(bookmarkAvatarSignal()), this, SLOT(addBookmark()));
|
||||
}
|
||||
});
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
auto context = offscreenUi->getRootContext();
|
||||
context->setContextProperty("avatarBookmarks", this);
|
||||
}
|
||||
|
||||
void AvatarBookmarks::changeToBookmarkedAvatar() {
|
||||
|
|
Loading…
Reference in a new issue