Details
-
Bug
-
Resolution: Invalid
-
P4: Low
-
None
-
5.11.1, 5.13.2
-
Linux Mint 18.3
Qt Creator 4.7.0-rc1 (4.6.84)
Description
I want to use a custom style for the virtual keyboard. I have all neccessary files added into my resources. When i set the path via
qputenv("QML2_IMPORT_PATH", QByteArray("qrc:///keyboards"));
it does not work. When is use
engine.addImportPath(QStringLiteral("qrc:/keyboards"));
my custom style is properly loaded and shows up in the UI.
Here the complete code:
int main(int argc, char *argv[])
{{{}}
//DEVNOTE: this does not work
//qputenv("QML2_IMPORT_PATH",QByteArray("qrc:///keyboards"));
qputenv("QT_IM_MODULE",QByteArray("qtvirtualkeyboard"));
qputenv("QT_VIRTUALKEYBOARD_STYLE" , QByteArray("bnr"));
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
// DEVNOTE: this works
engine.addImportPath(QStringLiteral("qrc:/keyboards"));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}