Using QtVirtualKeyboard



  • Hello to all,
    I'm using a raspberrypi3 with an OS and a cross-compiler built with yocto. Qt Version 5.7.1
    I'm trying to run the demo qtVirtualKeyboard. Compiling it, deploying and running with qtcreator, the program starts correctly but when I click on the text fields the keyboard doesn't show up.
    Trying to compile it through console I get the following output:

    compiling main.cpp
    In file included from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qglobal.h:83:0,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qtquickglobal.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickwindow.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickview.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/QQuickView:1,
    from main.cpp:30:
    /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qcompilerdetection.h:562:6: error: #error Qt requires a C++11 compiler and yours does not seem to be that.

    error Qt requires a C++11 compiler and yours does not seem to be that.

      ^
    

    In file included from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qatomic.h:46:0,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qglobal.h:1145,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qtquickglobal.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickwindow.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickview.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/QQuickView:1,
    from main.cpp:30:
    /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"

    error "Qt requires C++11 support"

    ^
    

    In file included from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qobjectdefs.h:50:0,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qmetatype.h:51,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickwindow.h:44,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickview.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/QQuickView:1,
    from main.cpp:30:
    /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtCore/qobjectdefs_impl.h:241:9: warning: identifier ‘decltype’ is a keyword in C++11 [-Wc++0x-compat]
    template <typename F> static auto test(F f) -> decltype(((f.operator()(
    ^
    In file included from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickwindow.h:45:0,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickview.h:43,
    from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/QQuickView:1,
    from main.cpp:30:
    /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtGui/qopengl.h:106:26: fatal error: GLES2/gl2.h: File o directory non esistente
    compilation terminated.
    Makefile:627: set di istruzioni per l'obiettivo ".obj/main.o" non riuscito
    make: *** [.obj/main.o] Errore 1

    For me, it's strange that calling make through console I get these errors while with qtcreator, I don't.
    Can you help me? Thank you in advanced.


  • Lifetime Qt Champion

    Hi,

    What version of GCC is it ? From the error it looks like it's way too old. If you can't update it, then you have to go with the latest version of Qt 5.6 which can be built without C++11 support.



  • Hello S.Gaist, thank you very much for your answers.

    the yocto version that generated the compiler is poky-morty, which has been released in 10/28/2016. Compiler version (GCC) 6.2.0.
    I've got some questions, maybe some of them could be silly :)

    About qt versions I'm a little confused about the following matter: yocto generated qmake is Qt5.7.1 version, while the packages of qtcreator 4.4.1, that I'm using, are built with Qt5.9.2. Isn't it an incongruence?

    Besides, if I have version 5.7.1 shouldn't I have the possibility to activate C++11 as required, since the latest one without it was 5.6?

    Regarding the possibility to change version, since I'm a newbie with yocto, it could be difficult for me to change yocto release or qt-recipe. if I download an older version of the qtvirtualkeyboard demo code, could it work?

    Thank you again.


  • Lifetime Qt Champion

    Then indeed, it's recent enough.

    No it's not, the version of Qt used to build Qt Creator has no influence on the version(s) you use for your projects.

    Yes, it should be able to build QtVirtualKeyboard since you already have a version of Qt that has C++11 as mandatory which makes the whole case even stranger.

    What steps did you take to configure and build the module ?



  • Hello StGaist,
    One note: at the current state, the platform plugins that I can use are EGLFS or LinuxFB. Are X11 or Wayland required for qtVirtualKeyboard module?
    Currently I'm googling how to include C++11 in my image recipe.

    I didn't take any steps different from the ones that I usually do.
    I just download the code from https://github.com/qt/qtvirtualkeyboard.git, and choose the basic project. Then I select the kit, compile the code and run it.
    In theory I have qtvirtualkeyboard plugin available in my sysroots, but since I didn't know how to include it in a project from scratch, I've prefered to download a demo.

    Qt packages that I've got in my image are the following:
    QT5_PKGS = "
    qt3d
    qt3d-dev
    qt3d-mkspecs
    qtcharts
    qtcharts-dev
    qtcharts-mkspecs
    qtconnectivity-dev
    qtconnectivity-mkspecs
    qtdeclarative
    qtdeclarative-dev
    qtdeclarative-mkspecs
    qtdeclarative-plugins
    qtdeclarative-qmlplugins
    qtgraphicaleffects
    qtgraphicaleffects-dev
    qtlocation-dev
    qtlocation-mkspecs
    qtlocation-plugins
    qtmultimedia
    qtmultimedia-dev
    qtmultimedia-mkspecs
    qtquickcontrols2
    qtquickcontrols2-dev
    qtquickcontrols2-mkspecs
    qtsensors-dev
    qtsensors-mkspecs
    qtsensors-plugins
    qtserialbus
    qtserialbus-dev
    qtserialbus-mkspecs
    qtsvg
    qtsvg-dev
    qtsvg-mkspecs
    qtwebsockets-dev
    qtwebsockets-mkspecs
    qtwebsockets-qmlplugins
    qtvirtualkeyboard
    qtvirtualkeyboard-dev
    qtxmlpatterns
    qtxmlpatterns-dev
    qtxmlpatterns-mkspecs
    "
    Thank you again.


  • Lifetime Qt Champion

    AFAIK, no it's doesn't have such needs. IIRC, it's QtQuick based.

    What demo ? There's already an example with the module.

    Note that the official repos are at https://code.qt.io Github is just a mirror.



  • Hello St Gaist, thank you for your response.

    • Regarding the examples that should come with the module, probably, because the sdk is compiled through yocto recipes, I haven't got any qt examples installed, That's why I have to download them. Indeed I still need to learn a lot!
      What I have inside sdk concerning VirtualKeyboard are qmldir, plugins.qmltypes and the folder Styles (contained in the path: /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/lib/qt5/qml/QtQuick/VirtualKeyboard).

    • Regarding the project, incuding CONFIG += c++11 and calling make via console, the c++1 error has disappeared.
      compiling main.cpp
      In file included from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickwindow.h:45:0,
      from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/qquickview.h:43,
      from /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtQuick/QQuickView:1,
      from main.cpp:30:
      /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/qt5/QtGui/qopengl.h:106:26: fatal error: GLES2/gl2.h: File o directory non esistente
      compilation terminated.
      Makefile:627: set di istruzioni per l'obiettivo ".obj/main.o" non riuscito
      make: *** [.obj/main.o] Errore 1
      However I've got that file but it's store in the following path /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/GLES2. Don't know why it's looking at a diffrent path.

    • If I try to make and deploy the program with QtCreator, the program starts but, when I try to click on a text field, the program crashes and I get "EGLFS: OpenGL windows cannot be mixed with others".
      Maybe it did the same from the beginning.

    What do you think?
    Thank you.


  • Lifetime Qt Champion

    So which project are you building ?



  • Well, actually the project that I started with, qtVirtualKeyboard version 5.1.0, is the same found in https://code.qt.io.
    The fact is that I get different results building and running the same program inside qtCreator, or accomplishing these steps via console.
    In qtCreator, the program starts correctly, but it crashes when I press a text line ("EGLFS: OpenGL windows cannot be mixed with others".)
    With the console, I cannot carry out the make process (error: GLES2/gl2.h: file or directory not found).
    I'm confused about this difference...


  • Lifetime Qt Champion

    Qt Creator sets everything up for the Qt version you are using to build your project.

    On the command line, it's up to you to ensure that you are using the correct stuff e.g. the correct qmake,



  • Hello StGaist, thank you a lot for your answer.
    I found out what was wrong with different qmake output issue. Basically calling qmake from console, I forgot to add -spec linux-oe-g++, as I do in QtCreator. Now both the makefiles generated are the same.
    The problem "EGLFS: OpenGL windows cannot be mixed with others" that makes crash the application, when I try to write in an edit field, remains.
    On internet I still didn't find a suitable solution, but I have been still looking for it...


  • Lifetime Qt Champion

    Which demo is it ?



  • Hello StGaist,
    thank you for your answer. The demo is git://code.qt.io/qt/qtvirtualkeyboard.git.

    The problem is similar to the one described int the following thread regarding combo boxes: https://bugreports.qt.io/browse/QTBUG-38405.
    From a comment of this "bug".
    "Qt Quick Controls 2 is designed for Embedded platforms, unlike Qt Quick Controls 1 which was designed for desktop and mobile first. In Qt Quick Controls 2 Combo boxes work because they don't try to create new native window surfaces on platforms that don't support doing so."

    I think that the problem is that qtvirtualkeyboard demo is designed with QtQuick1, so it cannot work with eglfs as it tries to create a new window. In other words, the demo should be written using Qt Quick Controls 2 for working correctly.
    What do you think about that?
    Thank you for your support.


  • Lifetime Qt Champion

    It's not a demo, it's a module

    Which version are you using exactly ?



  • Hello StGaist,
    If I understand the question correctly, I'm using the demo "basic.pro" contained inside git://code.qt.io/qt/qtvirtualkeyboard.git. The version is 5.10
    Thank you.


  • Lifetime Qt Champion

    That demo seems to use QtQuick 2 which IIRC should not suffer the troubles you have.



  • Hello StGaist, thank you for your message.
    I tried to download again the module, compile the demo and I get the same problem.
    I cannot find anything useful on internet, but I'll keep looking at.
    Maybe in the future I'll use x11 or wayland, and the problem shouldn't show up.



  • Hello to all,
    as far as I can understand, for those people which are using Yocto and want to use QtVirtualKeyboard, they have to install Boot2Qt, which contains recipes for installing the required software and making custom images.
    See below:
    http://doc.qt.io/QtForDeviceCreation/qtee-about-b2qt.html


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.