Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help with Technical Guide/Keyboard Styles
Forum Updated to NodeBB v4.3 + New Features

Help with Technical Guide/Keyboard Styles

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 391 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Circuits
    wrote on last edited by
    #1

    I followed the directions I was successfully able to alter a default style for the keyboard (simple background color change) as shown in the tutorial. So this altered style was placed in QtQuck/VirtualKeyboard/Styles. Would it be possible for me to instead import this Styles directory directly into my Qt Project and reference it from there? That way, if I want my application to run on a different system I wouldn't have to have them create the application with an altered version of the default Qt install directory?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Circuits
      wrote on last edited by Circuits
      #2

      I believe this should be possible. I tried creating a "NewFolder" in my project directory. Inside that folder I created a directory tree: QtQuick/VirtualKeyboard/Styles/test as shown:

      rob@linux044:~/QtLocalProjects$ ls
      keyboardTest  something
      rob@linux044:~/QtLocalProjects$ cd keyboardTest/
      rob@linux044:~/QtLocalProjects/keyboardTest$ ls
      keyboardTest.pro  keyboardTest.pro.user  main.cpp  main.qml  NewFolder  qml.qrc
      rob@linux044:~/QtLocalProjects/keyboardTest$ cd NewFolder/
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder$ ls
      QtQuick
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder$ cd QtQuick/
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick$ ls
      VirtualKeyboard
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick$ cd VirtualKeyboard/
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick/VirtualKeyboard$ ls
      Styles
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick/VirtualKeyboard$ cd Styles
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick/VirtualKeyboard/Styles$ ls
      test
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick/VirtualKeyboard/Styles$ cd test
      rob@linux044:~/QtLocalProjects/keyboardTest/NewFolder/QtQuick/VirtualKeyboard/Styles/test$ ls
      images  style.qml  virtualkeyboard_default_style.qrc
      

      then in main I tried setting the import path:

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
          //qputenv("QML2_IMPORT_PATH", ":/NewFolder/QtQuick/VirtualKeyboard/Styles/test");
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          engine.addImportPath(":/NewFolder");
          qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");
          const QUrl url(QStringLiteral("qrc:/main.qml"));
          QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                           &app, [url](QObject *obj, const QUrl &objUrl) {
              if (!obj && url == objUrl)
                  QCoreApplication::exit(-1);
          }, Qt::QueuedConnection);
          engine.load(url);
      
          return app.exec();
      }
      
      

      what am I doing wrong here? Perhaps I imported the existing directory incorrectly? I just right-clicked the project name and clicked import existing directory.

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Circuits
        wrote on last edited by
        #3

        Okay I see what I did wrong @test/virtualkeyboard_default_style.qrc the qresource prefix was set too: "/QtQuick/VirtualKeyboard/content/styles/default" instead it needed to be set too: "/QtQuick/VirtualKeyboard/content/styles/test" now it is working :)

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved