mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 19:39: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
|
// 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 QtQuick.Controls 2.2 as Original
|
||||||
import TabletScriptingInterface 1.0
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Original.Button {
|
||||||
property string buttonGlyph: "";
|
property string buttonGlyph: "";
|
||||||
|
|
||||||
//TODO: add real Action item. Backport from Qt 5.10
|
//TODO: add real Action item. Backport from Qt 5.10
|
||||||
property QtObject action: null
|
property Shortcut action: null
|
||||||
|
|
||||||
width: 120
|
width: 120
|
||||||
height: hifi.dimensions.controlLineHeight
|
height: hifi.dimensions.controlLineHeight
|
||||||
|
@ -37,6 +37,9 @@ Original.Button {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tabletInterface.playSound(TabletEnums.ButtonClick);
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
if (action !== null) {
|
||||||
|
action.activated()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||||
|
|
||||||
import "../controls-uit"
|
import "../controls-uit"
|
||||||
|
@ -145,24 +145,30 @@ ModalWindow {
|
||||||
margins: 0
|
margins: 0
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||||
}
|
}
|
||||||
Button { action: cancelAction }
|
Button {
|
||||||
Button { action: acceptAction }
|
action: cancelAction;
|
||||||
|
text: qsTr("Cancel");
|
||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Button {
|
||||||
|
action: acceptAction
|
||||||
|
text: qsTr("OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
id: cancelAction
|
id: cancelAction
|
||||||
text: qsTr("Cancel")
|
sequence: Qt.Key_Escape
|
||||||
shortcut: Qt.Key_Escape
|
onActivated: {
|
||||||
onTriggered: {
|
|
||||||
root.canceled();
|
root.canceled();
|
||||||
root.destroy();
|
root.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action {
|
|
||||||
|
Shortcut {
|
||||||
id: acceptAction
|
id: acceptAction
|
||||||
text: qsTr("OK")
|
sequence: Qt.Key_Return
|
||||||
shortcut: Qt.Key_Return
|
onActivated: {
|
||||||
onTriggered: {
|
|
||||||
root.result = items ? comboBox.currentText : textResult.text
|
root.result = items ? comboBox.currentText : textResult.text
|
||||||
root.selected(root.result);
|
root.selected(root.result);
|
||||||
root.destroy();
|
root.destroy();
|
||||||
|
|
Loading…
Reference in a new issue