binary001
31st October 2015, 17:39
Hi,
I've my custom key maps table (A=c, B=f, C=d, ..... etc.)
I type and show the texts in lineedit normally,
but after checked a checkbox, I want to replace every letter immediately with my custom map letter.
eg. in unchecked mode I type ABCDE then I checked and keep type ABCDE, the letters in lineedit is as follow:
ABCDcfdj
I want to see and replace letter in lineedit's every key pressed.
In VB, this work is very easy. In Qt C++, how can I do it?
my sample vb code are:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If ckMyMap.Value = 1 Then KeyAscii = KeyMap(KeyAscii)
End Sub
Public Function KeyMap(key As Integer) As Integer
'My Custom Key Map
If key = 65 Then
KeyMap = 99
ElseIf key = 66 Then
KeyMap = 102
ElseIf key = 67 Then
KeyMap = 100
ElseIf key = 68 Then
KeyMap = 106
ElseIf key ......
...............
...............
Else
KeyMap = key
End If
End Function
In Qt C++, how can I do it?
Thanks.
I've my custom key maps table (A=c, B=f, C=d, ..... etc.)
I type and show the texts in lineedit normally,
but after checked a checkbox, I want to replace every letter immediately with my custom map letter.
eg. in unchecked mode I type ABCDE then I checked and keep type ABCDE, the letters in lineedit is as follow:
ABCDcfdj
I want to see and replace letter in lineedit's every key pressed.
In VB, this work is very easy. In Qt C++, how can I do it?
my sample vb code are:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If ckMyMap.Value = 1 Then KeyAscii = KeyMap(KeyAscii)
End Sub
Public Function KeyMap(key As Integer) As Integer
'My Custom Key Map
If key = 65 Then
KeyMap = 99
ElseIf key = 66 Then
KeyMap = 102
ElseIf key = 67 Then
KeyMap = 100
ElseIf key = 68 Then
KeyMap = 106
ElseIf key ......
...............
...............
Else
KeyMap = key
End If
End Function
In Qt C++, how can I do it?
Thanks.