How to switch language in qt virtual keyboard in my application qml page? - qt

I have a Qt app on ARM board and because of touch I/O I should use the virtual keyboard. I have had config it and set English and Persian languages. Now I have a problem, I want to use just English for integer value, I can show the numbers in virtual keyboard but if the user has set the language to Persian, my text input set to Persian number. But I want all numbers in English format.(like the IP is in English format)
So, how to change the language for virtual keyboard when user just put integer value?

Related

Yubikey converts lower case letter of password into capital in Qt applications on Ubuntu 20.04

We have a yubikey 5 NFC with a static OTP password where the first letter is a lowercase letter. When using this password in a Qt5 application running on an Ubuntu 20.04.2 LTS device, the first letter gets transformed to an uppercase letter. After doing some quick testing, it looks like if the 2 letters following on the first letter are capitals, only then the first letter gets transformed to a capital letter when touching the yubikey.
Steps to reproduce:
configure slot 1 OTP static password to 'vVV' (first letter is lowercase, 2 following letters upper case )
Open a QT application (in our case we used QtCreator 4.11.0, Qt 5.12.8)
Open any text field (e.g. the one found via Help->Index)
When the field is empty, press few times backspace in that field, immediately followed by touching the yubi key to enter the password
the password entered will be 'VVV' and not 'vVV'
If you now press one more time on the yubi key, 'vVV' will be entered (so the content of the field will be 'VVVvVV'
To get 100% reproducibility, it's important that the backspace is pressed a few times before touching the yubi key. If not, then we are only able to sometimes trigger this issue.
This behavior happens in any Qt5 application running on our system. Not reproducible on Windows.
Did anyone else also encountered similar behavior in the past? Or could anyone perhaps confirm this behavior? And even better, is there some kind of fix available?
For anyone who encounters the same issue, it was caused by a bug in the Qt QPA X11/XCB layer. See https://bugreports.qt.io/browse/QTBUG-95933.

Sending keycodes instead of midi, looking for simple ways to send that info with a rythm pattern on arduino usb cable

Do you know if it is possible to have a device in between the keyboard and the computer , you press a recording key on the arduino, then press the letter P, the arduino keeps that P in memory and and the letter can be assigned to a rythm pattern and sent to the computer like this: P...P...P...PPPP..PP etc..
the information is received exactly the same way it comes in the computer with a physical keyboard.
the is a music based product as it is now the arduino can send midi to the computer and I would need a app to receive the midi data and convert it to keycode date so
I am looking at my other options to make the easiest system possible
Normaly keys are ASCII encoded so no need to get them from somewhere. So you could send over serial (usb) a char array either as ASCII characters
const char keyPresses[] = "P..P....P....P...P";
or ASCII encoded (depends on the Midi software used)
const uint8_t keyPresses[] = {80,,,80,,,80,,80};
To let the Arduino act like a keyboard (so the PC-SW is not aware that it is an Arduino) use the HID library, which has examples included for all kind of scenarios.To record a sequence of key presses a keylogger on the PCis the eseast way. Save to a txt file and copy and paste to the Arduino code or convert characters toASCII codes e.g. here online

QML Shortcut Hold event

I'm working on a Qt app, and developing most of the UI in QML. It will be mostly keyboard driven, and has quite a few pages/popups. So to avoid having a potential focus scope catastrophe, I've written most of the keybindings as Shortcuts.
Some of the shortcuts are to be activated when a key is held. These keys are physical buttons on a piece of external hardware. For instance, if Physical Key 1 is pressed, do action A. If Physical Key 1 is held for 2 seconds, do action B. How would I go about doing this?

What key is Keys.Context1 tied to in Qt/QML?

I'm currently building a proof of concept application, on windows, testing out what I can do with QML but the end result is going to run on an embedded Linux system (which I'll need to learn too). I've been working with key handling (Enter, Up, down, Left and Right etc.) and noticed that there are 4 keys marked as Context1 to 4.
In the QtQuick docs there is reference to Keys.Context1..4 with associated onPressed events but not about how they are used.
context1Pressed(KeyEvent event)
This signal is emitted when the Context1 key has been pressed. The event parameter provides information about the event.
The corresponding handler is onContext1Pressed.
How do I find out what physical keys these are bound to, or how can I specify which keys they bind to?
Qt/QML is intended for use on the desktop (Windows, Linux, Mac) and mobile platforms. I strongly suspect the contextX key events and handlers are for mobile platform use. I did some googling and you can see the intent on this Qtopia site. So you won't use these keys on Windows.
The key codes for the Keys enumeration is in CoreLib/Global/QNamespace.h; the Key_Context1..4 keys are bound to the key codes 0x01100000..3. As Tod has mentioned the keys are designed for the mobile platform, similar mobile keys are defined close to the context keys, for example: Key_Call, Key_Camera etc.
The Qt Embedded framework apparently reads the keys directly from the tty device (on Linux) and so doesn't use the OS key mappings, there is a patch that allows you to specify bindings like { Qt::Key_A, Qt::Key_Context1, Qt::Key_Unknown, Qt::Key_Unknown } from this page: http://llg.cubic.org/patches/qtegerman.html I'm not sure yet if that helps.
I hoped that I'd be able to use the OS inbuilt key mapping features, but if it is reading directly from the input device I'm not sure this is possible.
I'll update this if I learn any more.
Update
The platform we're running on has an API that deals with the keyboard device so Qt doesn't access it directly; I add a listener for each button and then send the key press event to Qt using:
QKeyEvent* key = QKeyEvent(QEvent::KeyPress, Qt::Key_Context1, Qt::NoModifier);
qApp->SendEvent(view, key).
where view is the QML DeclarativeView (or equivalent).

Get serial port data to a text box (.net 3.5)

I need to get serial port data to a textbox in the page, when I scan the barcode using a barcode scanner.
Can anyone tell me how to do this in asp.net 3.5?
On data received in serial port, that data should appear in textbox.
I am new to .net.
thanks
We have a system set up similarly here. We put the barcode reader into a mode whereby it outputs the characters that make up the barcode as if the user had typed them from the keyboard. So, to scan something and make it appear in a textbox, we would set Focus to the textbox, then scan the barcode and, voila, the text would appear.
That's just one way to do it. You could get a serial port reader "module" and incorporate it into your application, but I think this is much easier.

Resources