Reputation: 13691
I try to integrate the QtVirtualKeyboard
into a prototype, but I fail.
It is the first time I work with multiple projects or where I have to include non-basic-stuff in QML/QMake-Project.
I got the code from the git-repository and were successfully running the examples. But now I am puzzled on how to integrate it into my own project.
My project structure is as follows
Proto (dir)
+- Proto.pro
+- main.cpp
+- ...
+---QML (dir) <--- QML-Files
| +-main.qml
| +---CustomControls (dir)
| +---...
+---CPP (dir) <--- C++-Files and Headers
+---RES <--- Icons and stuff
Now I thought I might just add the src
-project from the virtual keyboard to the root-folder (Proto
), and add something like:
SUBDIR += src/src.pro
to the Proto.pro
-file
=> Yes, I can do that, but there is no merrit in it.
So what do I need to do, to actually use it? It must be really easy, for I can't find any question regarding it anywhere on google, youtube or SO.
EDIT => I still fail. This is my story:
I tried the deployment-method, followed the instructions here.
As I'd prefer to have the keyboard within the application, I did the following:
make install
-steptqmake
an additional argument "CONFIG+=disable-desktop
It seemed to work. Got new files in the mentioned directories:
Now in my project, I added the line
QT_IM_MODULE=qtvirtualkeyboard myapp
And tried to import it in my main.qml
import QtQuick.VirtualKeyboard 2.0 // (also tried it with 2.1)
I got the error:
[path]/main.qml:10 module "QtQuick.VirtualKeyboard" is not installed
And that concludes my story sofar. Any suggestions where I failed?
Upvotes: 5
Views: 22296
Reputation: 13691
Though it is indeed very close to the documentation, I don't think the documentation is easily understood. Therefore, here's a step-by-step guide to clear my own misconceptions:
qtvirtualkeyboard.pro
with the Qt Creator, and run it with the configuration release
QT_IM_MODULE
environment variable to include qtvirtualkeyboard
. My mistake was, to assume (I don't know why) this might be done in the projects .pro
-file. This seems to be wrong. The C++-method seems safe:qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
CONFIG += disable-desktop
to your projects .pro
-fileUpvotes: 13
Reputation: 24406
If you select the Qt Virtual Keyboard component under a particular Qt version, you should get the prebuilt binaries:
The Qt Enterprise Add-ons component has a virtual keyboard sub-component (?) which might only give you the sources.. not sure.
If you really need to have the module in your project's Git repo, it might be easier to just add it as a submodule, and reference that in a "3rdparty" SUBDIRS sub-project.
Upvotes: 3