linphone-desktop/Linphone/view/Control/Input/DigitInput.qml
Alexandre Jörgensen a9a78cb4bf Accessibility and code improvments:
* Normalize and correct linphone color
* Add border when user focus using keyboard navigation
* Correct some keyboard navigation
* Add accessibility screen reading to interactive elements except chat and meeting
2025-10-15 12:50:43 +02:00

52 lines
1.6 KiB
QML

import QtQuick
import QtQuick.Controls.Basic as Control
import Linphone
Control.TextField {
id: mainItem
property real inputSize: Math.round(100 * DefaultStyle.dp)
color: activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_500_main
validator: IntValidator{bottom: 0; top: 9}
width: inputSize * 0.9
height: inputSize
horizontalAlignment: TextInput.AlignHCenter
verticalAlignment: TextInput.AlignVCenter
overwriteMode: true
// just reserve the space for the background
placeholderText: "0"
placeholderTextColor: "transparent"
// cursorVisible is overwritten on focus change so useless to hide the cursor
cursorDelegate: Item{}
// horizontalAlignment: Control.TextField.AlignHCenter
font.family: DefaultStyle.defaultFont
font.pixelSize: inputSize / 2
font.weight: Math.round(300 * DefaultStyle.dp)
background: Item {
anchors.fill: parent
// width: mainItem.inputSize * 0.9
// height: mainItem.inputSize
Rectangle {
id: background
border.width: Math.round(Math.max(DefaultStyle.dp), 1)
border.color: mainItem.activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_500_main
radius: mainItem.inputSize * 0.15
width: mainItem.inputSize * 0.9
height: mainItem.inputSize
}
Rectangle {
id: indicator
visible: mainItem.activeFocus
color: DefaultStyle.main1_500_main
height : Math.max(1, Math.round(1 * DefaultStyle.dp))
width: mainItem.inputSize * 0.67
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Math.round((mainItem.inputSize / 8) * DefaultStyle.dp)
}
}
}