2

I need to build a custom Style for a Qt VirtualKeyboard on a small screen to maximize its readability. I have built a custom layout into my project, and using the QT_VIRTUALKEYBOARD_LAYOUT_PATH it works great.

The problem I am having is that the documentation states that the custom style must be placed in the Qt Directory. I need this style to be portable, however, so storing this newly built style on my local machine, rather than in the project itself, will not be acceptable.

Is there any way to build a use a keyboard style within a project?

Kyle Gray
  • 115
  • 1
  • 7

1 Answers1

1

It doesn't have to be in the Qt directory, just in a directory that is under QtQuick/VirtualKeyboard/Styles/ and in the QML import path.

As an example, take a look at the auto test:

http://code.qt.io/cgit/qt/qtvirtualkeyboard.git/tree/tests/auto/styles/data

You can also put the style in a .qrc file under that folder structure:

http://code.qt.io/cgit/qt/qtvirtualkeyboard.git/tree/src/virtualkeyboard/virtualkeyboardsettings.cpp#n70

I've created a task to make this clearer: https://bugreports.qt.io/browse/QTBUG-66172

Mitch
  • 23,716
  • 9
  • 83
  • 122
  • Hi Mitch, thanks for the reply. This seems to be the same solution that the documentation states. The problem I'm having is that it is not a portable solution that I can push up to my repository because the new style is in the Qt install on my computer, and then it is imported on compiling. I need to have the new style be a part of the project itself. For example, to put a new Layout, I used: `qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", ":/embres/components/layouts");` This was done in my main.cpp and put a path to the folder in my project containing my new layout. – Kyle Gray Feb 05 '18 at 15:49
  • The auto test I linked to does what you're trying to do (have the style in the project itself), except that it's on the file system as opposed to the resource system. – Mitch Feb 05 '18 at 17:15
  • 2
    Thank you Mitch, I got it working. It works similarly to the Keyboard Layout using qputenv("QML2_IMPORT_PATH", {folder containing structure QtQuick\VirtualKeyboard\Styles\{name of style}}); in my main.cpp. – Kyle Gray Feb 12 '18 at 22:14