Qt virtual keyboard capabilities
-
I have a few questions I was hoping someone could answer for me about the Qt virtual keyboard. Here is how I have implemented it so far:
Window { id: window visible: true width: 640 height: 480 title: qsTr("Hello World") property string dataIs: "" InputPanel { id: inputPanel z: 99 x: 0 y: window.height width: window.width states: State { name: "visible" when: inputPanel.active PropertyChanges { target: inputPanel y: window.height - inputPanel.height - 50 } } transitions: Transition { from: "" to: "visible" reversible: true ParallelAnimation { NumberAnimation { properties: "y" duration: 250 easing.type: Easing.InOutQuad } } } } TextInput { id: textInput x: 183 y: 118 width: 80 height: 20 text: qsTr("Text Input") font.pixelSize: 12 EnterKeyAction.enabled: textInput.text.length > 0 || textInput.inputMethodComposing EnterKeyAction.label: "Next" Keys.onReleased: { if (event.key === Qt.Key_Return) { dataIs = textInput.text console.log(dataIs) } } } }
the console logs are just for verification that I can manipulate already existing data within my program. My first question regards displaying information on the keyboard. Is it possible either through layouts or styles for me to show (on the keyboard itself) real time text display?
My second question regards the language switching capabilities of the keyboard. Currently the keyboard has a button the user can press which will allow them to select the language. I would like to disable that button and instead have the user select the language for the keyboard outside of the keyboard itself, will that be possible?
I do have a commercial Qt license if that is relevant. Keep in mind I did not right this portion of the code:
InputPanel { id: inputPanel z: 99 x: 0 y: window.height width: window.width states: State { name: "visible" when: inputPanel.active PropertyChanges { target: inputPanel y: window.height - inputPanel.height - 50 } } transitions: Transition { from: "" to: "visible" reversible: true ParallelAnimation { NumberAnimation { properties: "y" duration: 250 easing.type: Easing.InOutQuad } } } }
it was taken directly from the Qt website in order to help me get my feet on the ground with the virtual keyboard. Therefore, if the answer to either of my questions has something to do with setting up states and transitions and it seems like it should be obvious to me based on the code I have shown please understand that it is not because I did not write that code nor do I understand how it works.
-
@RobM
i suggest you read this: https://doc.qt.io/qt-5/technical-guide.html
Default language is taken from the locale
Appearance can be changed via custom layouts -
@RobM
i suggest you read this: https://doc.qt.io/qt-5/technical-guide.html
Default language is taken from the locale
Appearance can be changed via custom layouts@raven-worx Okay great, so it says that: "After the locale selection is done, the keyboard updates the input locale and input direction to match the current layout. The application can receive this information through the QInputMethod interface." I am assuming that would be through the localeChanged() function. Does that mean I would need to use QInputPanel instead of InputPanel for my keyboard? Also, I assuming that in order to get the real time text display that I would have to make a common change to each layout?
EDIT: Perhaps that assumption about the Panel is incorrect. Instead I think what I should do is make the selection in my main.cpp correct?