Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. the virtualkeyboard does not add to my project.
QtWS25 Last Chance

the virtualkeyboard does not add to my project.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 2 Posters 3.3k 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.
  • MhM93M Offline
    MhM93M Offline
    MhM93
    wrote on last edited by MhM93
    #1

    I add this to .pro file :

    QT +=qml quick
    CONFIG += c++11
    static {
        QT += svg
        QTPLUGIN += qtvirtualkeyboardplugin
    }
    disable-xcb {
        message("The disable-xcb option has been deprecated. Please use disable-desktop instead.")
        CONFIG += disable-desktop
    }
    
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =/opt/rootfs-s5p4418/usr/local/Trolltech/Qt-5.9.1-nexell32/qml/QtQuick/Controls.2/Material
    QML_IMPORT_PATH =/opt/rootfs-s5p4418/usr/local/Trolltech/Qt-5.9.1-nexell32/qml/Qt/labs
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =/opt/rootfs-s5p4418/usr/local/Trolltech/Qt-5.9.1-nexell32/qml/QtQuick/Controls.2/Material
    

    then add this to all qml file :

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import QtQuick.VirtualKeyboard 2.2
    import QtQuick.VirtualKeyboard.Settings 2.2
    

    and this code in main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QQmlEngine>
    
    int main(int argc, char *argv[])
    {
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        if (engine.rootObjects().isEmpty())
            return -1;
    
        return app.exec();
    }
    

    but there is no virtual keyboard come for my text editors.

    H.Ghassami

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Which platform? The virtual keyboard plugin is not available on iOS and Android yet., it is only there for embedded systems.

      (Z(:^

      1 Reply Last reply
      1
      • MhM93M Offline
        MhM93M Offline
        MhM93
        wrote on last edited by
        #3

        sorry to forget said, I used the embedded device. friendly arm.
        It does not show keyboard.
        I use Qt5.9.1.
        my device is nanopc t3 from friendlyarm.
        also in main.qml i write :

        import QtQuick 2.7
        import QtQuick.Controls 2.0
        import QtQuick.Layouts 1.3
        import QtQuick.VirtualKeyboard 2.1
        
        ApplicationWindow {
            visible: true
            width: 640
            height: 480
            title: qsTr("Hello World")
            TextInput {
                id: textInput;
                width: 200
                height: 200
                anchors.fill:parent
                color: "#000000";
                text: "salam" // black
        
                // http://doc.qt.io/qt-5/qinputmethod.html#properties
                focus: Qt.inputMethod.visible;
        
                verticalAlignment: TextInput.AlignVCenter;
            }
        
        
        }
        

        H.Ghassami

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I think you may need to implement the InputPanel for it to work. See the docs https://doc.qt.io/qt-5/qtvirtualkeyboard-deployment-guide.html

          Also, please check your console output - are there any plugin loading errors or warnings?

          You can try checking if QT_DEBUG_PLUGINS will help: https://doc.qt.io/qt-5/deployment-plugins.html#debugging-plugins

          (Z(:^

          1 Reply Last reply
          0
          • MhM93M Offline
            MhM93M Offline
            MhM93
            wrote on last edited by
            #5

            my problem is basic example that belongs to qt example is work perfectly on my device, but I copy that code, that I think they are essetional, but my prj not worked.
            I want to know is there any thing I missed?

            H.Ghassami

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              I don't know, I can only keep guessing unfortunately.

              Is your build static? Otherwise your .pro won't include the virtual keyboard.

              BTW. As paying customer you have access to Qt support, so you can also ping Qt Company about this.

              (Z(:^

              1 Reply Last reply
              1
              • MhM93M Offline
                MhM93M Offline
                MhM93
                wrote on last edited by
                #7

                I use open source qt version.
                I just know I should add static link in .pro file and add
                qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                to main.cpp file to use the virtual keyboard. but my virtual keyboard does not fire.

                H.Ghassami

                sierdzioS 1 Reply Last reply
                0
                • MhM93M Offline
                  MhM93M Offline
                  MhM93
                  wrote on last edited by MhM93
                  #8

                  just set the input method.

                  InputPanel{
                          id:inputpanel
                          visible:active
                          y:active?parent.height - inputpanel.height : parent.height
                          anchors.left: parent.left
                          anchors.right: parent.right
                  
                      }
                      TextInput{
                          id:input
                          inputMethodHints: Qt.ImhDigitsOnly
                          focus: Qt.inputMethod.visible;
                          text: "123211"
                  
                      }
                      TextInput{
                          id:input2
                          anchors.top:input.bottom
                          inputMethodHints: Qt.ImhLowercaseOnly
                          focus: Qt.inputMethod.visible;
                          text: "123211"
                  
                      }
                  

                  H.Ghassami

                  1 Reply Last reply
                  0
                  • MhM93M MhM93

                    I use open source qt version.
                    I just know I should add static link in .pro file and add
                    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                    to main.cpp file to use the virtual keyboard. but my virtual keyboard does not fire.

                    sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    @MhM93 said in the virtualkeyboard does not add to my project.:

                    I use open source qt version.

                    Then all your code (of your app) should be licensed under GPLv3, I hope you are aware of that.

                    Are you sure QtVirtualKeyboard plugin has been built? Do you see it in your Qt installation? Do you deploy it as mentioned in https://doc.qt.io/qt-5/qtvirtualkeyboard-deployment-guide.html ? Your .pro file does not contain any deployment code.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      @MhM93 said in the virtualkeyboard does not add to my project.:

                      just know I should add static link in .pro file and add

                      yes, but do you build in static mode? Do you set CONFIG+=static anywhere in your .pro or when calling qmake? Because if not, then this code will never be called:

                      static {
                          QT += svg
                          QTPLUGIN += qtvirtualkeyboardplugin
                      }
                      

                      (Z(:^

                      MhM93M 1 Reply Last reply
                      1
                      • sierdzioS sierdzio

                        @MhM93 said in the virtualkeyboard does not add to my project.:

                        just know I should add static link in .pro file and add

                        yes, but do you build in static mode? Do you set CONFIG+=static anywhere in your .pro or when calling qmake? Because if not, then this code will never be called:

                        static {
                            QT += svg
                            QTPLUGIN += qtvirtualkeyboardplugin
                        }
                        
                        MhM93M Offline
                        MhM93M Offline
                        MhM93
                        wrote on last edited by
                        #11

                        @sierdzio when I remove static flag it works too.
                        means just this:

                        QT += svg
                            QTPLUGIN += qtvirtualkeyboardplugin
                        

                        so there is no problem with this licence. Is it true?

                        H.Ghassami

                        sierdzioS 1 Reply Last reply
                        0
                        • MhM93M MhM93

                          @sierdzio when I remove static flag it works too.
                          means just this:

                          QT += svg
                              QTPLUGIN += qtvirtualkeyboardplugin
                          

                          so there is no problem with this licence. Is it true?

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          @MhM93 said in the virtualkeyboard does not add to my project.:

                          when I remove static flag it works too.

                          So the problem is solved?

                          so there is no problem with this licence. Is it true?

                          I'm not a lawyer, can't answer that with certainty. Since the virtual keyboard is licensed under GPL, and it is being linked into your project, I think you are still required tolicense your code under GPL.

                          (Z(:^

                          1 Reply Last reply
                          0

                          • Login

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