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

QTVK basic example. Desktop vs Embedded



  • Alright I need to go back to the basics here because apparently I still don't understand how this works. In basic (virtual keyboard example) the pro file has these lines:

    disable-desktop|android-embedded|!isEmpty(CROSS_COMPILE)|qnx {
        DEFINES += MAIN_QML=\\\"basic-b2qt.qml\\\"
    } else {
        DEFINES += MAIN_QML=\\\"Basic.qml\\\"
    }
    

    from what I understand these lines will detect what platform you are on and based on that will decide if the keyboard should be opening in a dedicated top-level window or embedded within the application, correct?

    So I figured that if I want the keyboard to be embedded within the application then I should simply be able to alter the .pro file like so:

    TEMPLATE = app
    TARGET = basic
    QT += qml quick
    SOURCES += main.cpp
    CONFIG += link_pkgconfig
    static {
        QT += svg
        QTPLUGIN += qtvirtualkeyboardplugin
    }
    
    target.path = $$[QT_INSTALL_EXAMPLES]/virtualkeyboard/basic
    INSTALLS += target
    
    RESOURCES += \
        demo.qrc
    
    OTHER_FILES += \
        Basic.qml \
        basic-b2qt.qml \
        content/AutoScroller.qml \
        content/HandwritingModeButton.qml \
        content/TextArea.qml \
        content/TextField.qml \
    
    #zdisable-xcb {
    #    message("The disable-xcb option has been deprecated. Please use disable-desktop instead.")
    #    CONFIG += disable-desktop
    #}
    
    CONFIG += disable-desktop
    
    disable-desktop|android-embedded|!isEmpty(CROSS_COMPILE)|qnx {
        DEFINES += MAIN_QML=\\\"basic-b2qt.qml\\\"
    } else {
        DEFINES += MAIN_QML=\\\"Basic.qml\\\"
    }
    

    however this doesn't work. So perhaps someone can tell me how I need to alter this .pro file so that the keyboard shows up embedded in the application itself and not as a dedicated top-level window?


Log in to reply