0

I am modifying an existing GUI to include a virtual keyboard to run on a Raspberry Pi with a touchscreen. The problem is that it takes up too much space and blocks the whole screen, that's why I want to modify it with a custom style.

Despite including the style as described in the Qt Documentation (https://doc.qt.io/qt-5/technical-guide.html#keyboard-styles), the code cannot find it, and it resorts to Default. The style is located in the .qrc file, I tried to include it in my main function like this:

#include "mainwindow.h"
#include <QApplication>
#include <QTranslator>
#include <QLoggingCategory>

int main(int argc, char *argv[])
{
    #ifdef LINUX
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
        qputenv("QML2_IMPORT_PATH", QByteArray("qrc:/kbstyles/QtQuick/VirtualKeyboard/Styles/test"));
        qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");
        qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
    #endif
    QApplication a(argc, argv);

    QTranslator translator;
    translator.load(QLocale(),"modbusReader","_",".");
    a.installTranslator(&translator);
    MainWindow w;

    w.show();

    return a.exec();
}

The "test" style can be found here inside my .qrc:

Folder structure

I tried the following solutions, but none of them seemed to work in my application:

AlexApps99
  • 3,506
  • 9
  • 21
Paul
  • 1

0 Answers0