mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-28 17:29:19 +00:00
Handle numeric keypad typing on keypad
This commit is contained in:
parent
f80620f900
commit
5c52ef225e
2 changed files with 69 additions and 1 deletions
|
|
@ -19,6 +19,71 @@ FocusScope{
|
|||
signal launchCall()
|
||||
signal wipe()
|
||||
|
||||
function keypadKeyPressedAtIndex(index) {
|
||||
var button = numPadGrid.getButtonAt(index)
|
||||
button.shadowEnabled = true
|
||||
button.clicked()
|
||||
removeButtonsShadow.restart()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: removeButtonsShadow
|
||||
interval: 250
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
for (var i = 0; i < 12; i++) {
|
||||
numPadGrid.getButtonAt(i).shadowEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.modifiers & Qt.KeypadModifier) {
|
||||
if (event.key === Qt.Key_0) {
|
||||
keypadKeyPressedAtIndex(10)
|
||||
}
|
||||
if (event.key === Qt.Key_1) {
|
||||
keypadKeyPressedAtIndex(0)
|
||||
}
|
||||
if (event.key === Qt.Key_2) {
|
||||
keypadKeyPressedAtIndex(1)
|
||||
}
|
||||
if (event.key === Qt.Key_3) {
|
||||
keypadKeyPressedAtIndex(2)
|
||||
}
|
||||
if (event.key === Qt.Key_4) {
|
||||
keypadKeyPressedAtIndex(3)
|
||||
}
|
||||
if (event.key === Qt.Key_5) {
|
||||
keypadKeyPressedAtIndex(4)
|
||||
}
|
||||
if (event.key === Qt.Key_6) {
|
||||
keypadKeyPressedAtIndex(5)
|
||||
}
|
||||
if (event.key === Qt.Key_7) {
|
||||
keypadKeyPressedAtIndex(6)
|
||||
}
|
||||
if (event.key === Qt.Key_8) {
|
||||
keypadKeyPressedAtIndex(7)
|
||||
}
|
||||
if (event.key === Qt.Key_9) {
|
||||
keypadKeyPressedAtIndex(8)
|
||||
}
|
||||
if (event.key === Qt.Key_Asterisk) {
|
||||
keypadKeyPressedAtIndex(9)
|
||||
}
|
||||
if (event.key === Qt.Key_Plus) {
|
||||
mainItem.buttonPressed("+")
|
||||
}
|
||||
if (event.key === Qt.Key_Enter) {
|
||||
mainItem.launchCall()
|
||||
}
|
||||
}
|
||||
if (event.key === Qt.Key_Backspace) {
|
||||
mainItem.wipe()
|
||||
}
|
||||
}
|
||||
|
||||
Layout.GridLayout {
|
||||
id: numPadGrid
|
||||
anchors.fill: parent
|
||||
|
|
@ -48,7 +113,6 @@ FocusScope{
|
|||
required property int index
|
||||
implicitWidth: 60 * DefaultStyle.dp
|
||||
implicitHeight: 60 * DefaultStyle.dp
|
||||
focus: index == 4
|
||||
onClicked: {
|
||||
mainItem.buttonPressed(innerText.text)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ Control.Popup {
|
|||
color: DefaultStyle.grey_100
|
||||
visible: !mainItem.roundedBottom
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: numPad.forceActiveFocus()
|
||||
}
|
||||
Button {
|
||||
id: closeButton
|
||||
visible: mainItem.closeButtonVisible
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue