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

the virtualkeyboard does not add to my project.



  • 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.


  • Moderators

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



  • 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;
        }
    
    
    }
    

  • Moderators

    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



  • 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?


  • Moderators

    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.



  • 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.



  • 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"
    
        }
    

  • Moderators

    @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.


  • Moderators

    @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
    }
    


  • @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?


  • Moderators

    @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.


Log in to reply