Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69435

setting QML2_IMPORT_PATH does not work

    XMLWordPrintable

Details

    • Linux/X11

    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();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tristan74656 Tristan Heitzinger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes