mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 19:17:43 +02:00
Make QueryDioalogs buttons works
This commit is contained in:
parent
6b732804eb
commit
2852375285
2 changed files with 22 additions and 13 deletions
|
@ -8,7 +8,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2 as Original
|
||||
import TabletScriptingInterface 1.0
|
||||
|
||||
|
@ -22,7 +22,7 @@ Original.Button {
|
|||
property string buttonGlyph: "";
|
||||
|
||||
//TODO: add real Action item. Backport from Qt 5.10
|
||||
property QtObject action: null
|
||||
property Shortcut action: null
|
||||
|
||||
width: 120
|
||||
height: hifi.dimensions.controlLineHeight
|
||||
|
@ -37,6 +37,9 @@ Original.Button {
|
|||
|
||||
onClicked: {
|
||||
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||
if (action !== null) {
|
||||
action.activated()
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||
|
||||
import "../controls-uit"
|
||||
|
@ -145,24 +145,30 @@ ModalWindow {
|
|||
margins: 0
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||
}
|
||||
Button { action: cancelAction }
|
||||
Button { action: acceptAction }
|
||||
Button {
|
||||
action: cancelAction;
|
||||
text: qsTr("Cancel");
|
||||
}
|
||||
|
||||
Button {
|
||||
action: acceptAction
|
||||
text: qsTr("OK");
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
Shortcut {
|
||||
id: cancelAction
|
||||
text: qsTr("Cancel")
|
||||
shortcut: Qt.Key_Escape
|
||||
onTriggered: {
|
||||
sequence: Qt.Key_Escape
|
||||
onActivated: {
|
||||
root.canceled();
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
Action {
|
||||
|
||||
Shortcut {
|
||||
id: acceptAction
|
||||
text: qsTr("OK")
|
||||
shortcut: Qt.Key_Return
|
||||
onTriggered: {
|
||||
sequence: Qt.Key_Return
|
||||
onActivated: {
|
||||
root.result = items ? comboBox.currentText : textResult.text
|
||||
root.selected(root.result);
|
||||
root.destroy();
|
||||
|
|
Loading…
Reference in a new issue