diff --git a/interface/resources/qml/controls-uit/Button.qml b/interface/resources/qml/controls-uit/Button.qml index 3755312128..59f8a63238 100644 --- a/interface/resources/qml/controls-uit/Button.qml +++ b/interface/resources/qml/controls-uit/Button.qml @@ -23,33 +23,8 @@ Original.Button { HifiConstants { id: hifi } - // 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: ... - - onClicked: fromTimer.running = true - signal queuedClicked() - Timer { - id: fromTimer - interval: 5 - repeat: false - running: false - onTriggered: { console.info('onQueuedClicked->onTriggered'); queuedClicked() } - } - onQueuedClicked: console.info('HifiControls.Button -- please define onClicked: or onQueuedClicked:') - style: ButtonStyle { + background: Rectangle { radius: hifi.buttons.radius diff --git a/interface/resources/qml/controls-uit/QueuedButton.qml b/interface/resources/qml/controls-uit/QueuedButton.qml new file mode 100644 index 0000000000..36ffbe582f --- /dev/null +++ b/interface/resources/qml/controls-uit/QueuedButton.qml @@ -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 +} diff --git a/interface/resources/qml/dialogs/preferences/AvatarPreference.qml b/interface/resources/qml/dialogs/preferences/AvatarPreference.qml index b98b706c37..9e2ac34c64 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarPreference.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarPreference.qml @@ -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 } - onQueuedClicked: avatarBookmarks.addBookmark() + onClickedQueued: avatarBookmarks.addBookmark() } Button { diff --git a/interface/resources/qml/hifi/dialogs/RunningScripts.qml b/interface/resources/qml/hifi/dialogs/RunningScripts.qml index 5321aacd25..d95dbc2e55 100644 --- a/interface/resources/qml/hifi/dialogs/RunningScripts.qml +++ b/interface/resources/qml/hifi/dialogs/RunningScripts.qml @@ -219,18 +219,18 @@ ScrollingWindow { Row { spacing: hifi.dimensions.contentSpacing.x - HifiControls.Button { + HifiControls.QueuedButton { text: "from URL" color: hifi.buttons.black height: 26 - onQueuedClicked: ApplicationInterface.loadScriptURLDialog() + onClickedQueued: ApplicationInterface.loadScriptURLDialog() } - HifiControls.Button { + HifiControls.QueuedButton { text: "from Disk" color: hifi.buttons.black height: 26 - onQueuedClicked: ApplicationInterface.loadDialog() + onClickedQueued: ApplicationInterface.loadDialog() } HifiControls.Button {