2

I am using QT5.15.2 and facing an issue displaying the Popup on top of QML Virtual keyboard. I am in process of migrating the application form 5.12.5 to 5.15.2 and found this issue. The same code works as expected in QT5.12.5.

main.qml

import QtQuick 2.10
import QtQuick.Window 2.10
import QtQuick.VirtualKeyboard 2.2
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3

Window {
    id: window
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Button{
        id:buttonID
        height: 50
        width: 150
        text: "Click me"
        onClicked: {
            popupX.open()
        }
    }

    TextField{
        anchors.top: buttonID.bottom
        anchors.topMargin: 10
        placeholderText: qsTr("Enter name")
    }

    InputPanel {
        id: inputPanel
        x: 0
        y: window.height/2
        width: window.width
        anchors.bottom:parent.bottom
    }

    Popup{
        id: popupX
        focus: true
        width: 200
        height: 300
        modal: true
        padding: 0
        closePolicy: Popup.NoAutoClose
        anchors.centerIn: parent
        Overlay.modal: Rectangle {
            color: "#c8000000"
            /* here we use 8 bit color coding
                       first 2 bits define opacity.
                       the remaining six define standard color code.
                       */
        }
        ColumnLayout {
            anchors.fill: parent
            CheckBox { text: qsTr("E-mail") }
            CheckBox { text: qsTr("Calendar") }
            CheckBox { text: qsTr("Contacts") }
        }
    }
}

main.cpp

#include <QGuiApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}

Results of the run on QT 5.15 and 5.12:

QT 5.15.2 QT 5.15.2

QT 5.12.5 QT 5.12.5

Please let me know if you have any suggestions on how to resolve this issue in 5.15.2.

pra7
  • 834
  • 2
  • 21
  • 50

0 Answers0