[Interest] Fwd: Capital letters with Qt Virtual Keyboard

Luca Carlon carlon.luca at gmail.com
Tue Jul 24 12:44:42 CEST 2018


On Tue, Jul 24, 2018 at 11:29 AM Mitch Curtis <mitch.curtis at qt.io> wrote:
>
> > -----Original Message-----
> > From: Interest <interest-bounces+mitch.curtis=qt.io at qt-project.org> On
> > Behalf Of Luca Carlon
> > Sent: Monday, 23 July 2018 7:48 PM
> > To: <interest at qt-project.org> <interest at qt-project.org>
> > Subject: [Interest] Capital letters with Qt Virtual Keyboard
> >
> > Hello! I wrote this simple code with the Qt Virtual Keyboard:
> >
> > import QtQuick 2.8
> > import QtQuick.VirtualKeyboard 2.3
> > Rectangle {
> >        width: 800
> >        height: 800
> >        TextInput {
> >                anchors.top: parent.top
> >                anchors.bottom: panel.top
> >                width: parent.width
> >                focus: true
> >        }
> >        InputPanel {
> >                id: panel
> >                anchors.left: parent.left
> >                anchors.right: parent.right
> >                anchors.bottom: parent.bottom
> >        }
> > }
> >
> >
> > What I notice is that the shift key is not enabled. However, it becomes
> > enabled if I click on the TextInput. Is this the expected behavior? Is it possible
> > to enable it automatically?
>
> What do you mean by enable it automatically? What is the expected behaviour?

Thank you for your answer! (and sorry, sent you this twice)

What I see here is that when the sample above runs in Qt 5.11.0, the
focus is on the TextInput, the shift button is not enabled and not
"selected", letters are lowercase. Do you see the same?
If I click on the TextInput element, the shift button is enabled, it
is selected and letters are uppercase. I'm not sure why, I'd expect
the shift key to be immediately enabled and selected and also letters
to be uppercase. Why should a click be needed?
At the moment I temporarily changed this by not checking for
visibility here:
https://github.com/qt/qtvirtualkeyboard/blob/5.11/src/virtualkeyboard/shifthandler.cpp#L271.
Is it normal that isVisible() returns false there at the beginning?

What I'm trying to do actually is to get the pressed keys in a custom
InputMethod object instantiated in QML, without having to introduce a
TextInput at all. In that case I see the same behaviour. Do you think
this is the proper way to set a custom InputMethod?

InputMethod { id: myInputMethod; [...] }
Component.onCompleted: { InputContext.inputEngine.inputMethod = myInputMethod }

By doing this I also see that the shift key is not automatically
"deselected" after a key is pressed. Any idea why?

> > Also, is there anything wrong in the sample above? When I click on the key
> > that switches to the synbols I get a considerable amount of warnings:
> >
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:66:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:135:9: QML
> > Rectangle: Cannot anchor to an item that isn't a parent or sibling.
> > [...]
> >
> > The result seems correct, but I guess those warnings mean I did something
> > wrong.
>
> Which Qt version are you using? See https://bugreports.qt.io/browse/QTBUG-67677 for the warnings. I'm unable to reproduce them with the 5.9 branch, so it could be that they've been indirectly fixed somehow. There are fixes for the warnings in 5.11.1 and dev.

Perfect, thank you!

Luca



More information about the Interest mailing list