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

QWebView crash when keyboard is shown



  • Hello,

    I have a problem with a WebView and shown keyboard. I would like to open WebView after put the text inside the TextField and after press the Button.
    I can do this on 2 cases:

      • put the text inside TextField (keyboard is shown)
    • press the button
    • the webView is shown
      • put the text inside TextField (keyboard is shown)
    • hide the keyboard by click "OK" (keyboard is hidden)
    • press the button
    • the webView is shown

    In case no. 2 everything is OK, but in case 1 the appliaction going to crash. I dont understand why..
    I was trying to hide keyboard before open webBrowser.qml but it didn't help.

    Main.xml

    ApplicationWindow {
        id: mainWindow
        width: Screen.desktopAvailableWidth
        height: Screen.desktopAvailableHeight
        visible: true
        title: qsTr("BarcodeApp")
    
       ...
    
    TextField{
                    id: textFieldCode
                    validator: DoubleValidator {top: 9999999999999;}
                    maximumLength: 13
                    inputMethodHints: Qt.ImhFormattedNumbersOnly
                    Material.accent: Material.color(Material.Blue)
                    anchors.horizontalCenter: columnDialog.horizontalCenter
    
    }
    
    Button{
                    id: buttonSearch
                    text: "Wyszukaj"
                    highlighted: true
                    Material.accent: Material.color(Material.Blue, Material.Shade600)
                    anchors.horizontalCenter: columnDialog.horizontalCenter
    
                    enabled: errorSyntaxCode==0 ? true : false
    
                    onClicked: {
                        console.log("CRASH IN THIS ACTIONS");
                        var browserComponent = Qt.createComponent("webBrowser.qml");
                        var browserWindow2 = browserComponent.createObject(mainWindow);
                        browserWindow2.show();
    
                    }
     }
    

    webBrowser.qml:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Controls.Material 2.12
    import QtQuick.Layouts 1.12
    import QtQuick.Controls.Styles 1.4
    
    import QtWebView 1.1
    
    Window{
        id: webBrowserMain
        width: Screen.desktopAvailableWidth
        height: Screen.desktopAvailableHeight
        visible: true
        title: qsTr("Browser")
        color: "black"
    
    ...
    
        WebView {
            id: webView
            focus: true
    
            anchors {
                top: parent.top
                left: parent.left
                right: parent.right
                bottom: bottomToolBar.top
            }
    
            url: "https://www.google.pl/"
    
        }
    
    }
    
    

    LOGS:

    D ViewRootImpl@ea481dc[QtActivity]: ViewPostIme pointer 0
    D InputMethodManager: HSIFW - flag : 0 Pid : 23997
    D ViewRootImpl@ea481dc[QtActivity]: ViewPostIme pointer 1
    D libBarcode_REU_V02.so: qml: CRASH IN THIS ACTIONS
    I Barcode_REU_V0: Thread[4,tid=24024,WaitingInMainSignalCatcherLoop,Thread*=0xdb008c00,peer=0x12f40270,"Signal Catcher"]: reacting to signal 3
    12-14 17:51:33.058 23997 24024 I Barcode_REU_V0:
    I Barcode_REU_V0: Wrote stack traces to tombstoned```

Log in to reply