Customised virtual keyboard in QT not working
Unsolved
QML and Qt Quick
-
I tried to increase the key pad size in qt virtual keyboard but its not working by using the below link https://stackoverflow.com/questions/48592098/qt-virtual-keyboard-custom-style.Could you please help me if i have missed anything?
-
@Shwetha using the QT_VIRTUALKEYBOARD_LAYOUT_PATH work well in my app.
I copy the style.qml file and layouts dir(en_US, zh_CN, fallback) in my project. and add put these files in a resources file.
Change the files in layouts and I can meet my requirment.
for example ,the keypad width is 3 times of height in the following pic(I change the digitals.qml)
KeyboardLayout { inputMethod: PlainInputMethod {} inputMode: InputEngine.InputMode.Numeric KeyboardColumn { Layout.fillWidth: false Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: 3 * height // three times of height KeyboardRow { Key { key: Qt.Key_7 text: "7" } Key { key: Qt.Key_8 text: "8" } Key { key: Qt.Key_9 text: "9" } BackspaceKey {} }
// in mail.cpp file
/* QT6键盘布局不合适,使用自定义虚拟键盘布局 */
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", "qrc:/CalfFeeding/QtQuick/VirtualKeyboard/Styles/black/layouts");/* 设置自定义键盘样式 */ qputenv("QT_VIRTUALKEYBOARD_STYLE", "black"); /* 使用虚拟键盘 */ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));