Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Add plugin to QML project



  • Hello,
    I'm working on a project for an embedded device which does not support recent Qt version. Because of this, it does not handle the Qt VirtualKeyboard.
    In order to solved that I found this code : https://github.com/githubuser0xFFFF/QtFreeVirtualKeyboard
    It seems to be enough for what I need to do but I don't have any ideas on how to add it to my project. I've neved added any external Qt module on a project.
    Does anybody can help me with that ?

    Thank you in advance



  • Hi @DavidM29

    This builds as a Qt plugin as the .pro file is configured with

    CONFIG += plugin
    

    You can find out what to do from looking at the same .pro file:

    deployment.files = *.qml FontAwesome.otf qmldir
    
    deployment.path = $$[QT_INSTALL_QML]/QtQuick/FreeVirtualKeyboard
    target.path = $$[QT_INSTALL_PLUGINS]/platforminputcontexts
    

    After building the plugin as you would any project in Qt Creator, you must copy the files listed in the deployment.files variable (all QML files, the font file and the qmldir file) to

    $$[QT_INSTALL_QML]/QtQuick/FreeVirtualKeyboard
    

    where QT_INSTALL_QML is the QML source code directory for your current kit (e.g. D:\Qt\5.11.0\msvc2017_64\qml)

    The plugin directory for your current kit is e.g: D:/Qt/5.11.0/msvc2017_64/plugins.
    You can get the values of all these QT_ variables by adding a line such as the following in your .pro file:

    message(Plugins: $$[QT_INSTALL_PLUGINS])
    

    and look for it in the General Messages tab in Qt Creator.

    Thus you need to copy the plugin files built (.dll and.lib) to

    $$[QT_INSTALL_PLUGINS]/platforminputcontexts
    

    There are already other files in that dir; just add yours.
    To be complete, you can add both Release and Debug versions of the plugin files in there, adding a suffix d to the filename for the Debug version.

    Once all the files are copied, you can just open the example project included in the rep and it should run (no need to restart Qt for the new plugin). I don't understand though why the above deployment steps are not executed automatically as specified in the .pro file...

    Good luck!



  • @Diracsbracket
    If I understand well the VirtualKeyboard is not installed in my project but in my Qt Creator ? Then I have to make sure it deploys as well in my final build ?



  • @DavidM29
    How are you currently deploying?



  • How can I figure this out ? I'm using a virtual machine with everything provided by the embedded device constructor.
    I know that it is for a Arm platform and a Qt5 version. (This is the answer to your first question that you changed)

    I can use my device by deploying in real time in it. I mean by that that once I build the project I can run it on a Remote linux host which is my embedded device.

    By the way I made some progress in the way to use it I'm now able to run the demo app with the keyboard working.



  • @DavidM29
    Since it seems you are using the dynamically linked Qt version and that you seem to let Qt Creator do the deployment, the plugin will also be deployedm, along with all the other Qt plugins you are using, I wager.

    Does the example work on the target?



  • @Diracsbracket
    I haven't tried on the target. I just tried on my windows version of Qt. I'm going to try it on the virtual machine.



  • @DavidM29
    Well, since it seems that you are not using any custom deployment steps (i.e. Qt Creator does everythying), then that example should also work on your linux target I guess.


Log in to reply