Improved text field
This commit is contained in:
@@ -4,33 +4,46 @@ import matzman666.advsettings 1.0
|
|||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
property int keyBoardUID: 0
|
property int keyBoardUID: 0
|
||||||
|
property string savedText: ""
|
||||||
id: myTextField
|
id: myTextField
|
||||||
color: "#cccccc"
|
color: "#cccccc"
|
||||||
text: ""
|
text: ""
|
||||||
font.pointSize: 20
|
font.pointSize: 20
|
||||||
background: Rectangle {
|
background: Button {
|
||||||
color: parent.activeFocus ? "#2c435d" : "#1b2939"
|
hoverEnabled: true
|
||||||
border.color: "#cccccc"
|
background: Rectangle {
|
||||||
border.width: 2
|
color: parent.hovered ? "#2c435d" : "#1b2939"
|
||||||
}
|
border.color: "#cccccc"
|
||||||
onEditingFinished: {
|
border.width: 2
|
||||||
if (OverlayController.desktopMode) {
|
}
|
||||||
myTextField.onInputEvent(text)
|
onClicked: {
|
||||||
|
myTextField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if (activeFocus && !OverlayController.desktopMode) {
|
if (activeFocus) {
|
||||||
OverlayController.showKeyboard(text, keyBoardUID)
|
if (!OverlayController.desktopMode) {
|
||||||
|
OverlayController.showKeyboard(text, keyBoardUID)
|
||||||
|
} else {
|
||||||
|
savedText = text
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onInputEvent(input) {
|
onEditingFinished: {
|
||||||
text = input
|
if (OverlayController.desktopMode && savedText !== text) {
|
||||||
|
myTextField.onInputEvent(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onInputEvent(input) {
|
||||||
|
text = input
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: OverlayController
|
target: OverlayController
|
||||||
onKeyBoardInputSignal: {
|
onKeyBoardInputSignal: {
|
||||||
if (userValue == keyBoardUID) {
|
if (userValue == keyBoardUID) {
|
||||||
myTextField.onInputEvent(input)
|
if (myTextField.text !== input) {
|
||||||
|
myTextField.onInputEvent(input)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user