Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Webview always over other objects
Forum Updated to NodeBB v4.3 + New Features

Webview always over other objects

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 818 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by Mikeeeeee
    #1

    Hi!
    I have a Webview . Created a menu button with a pop-up menu. A Webview is always displayed above this menu, even if the menu is made in main.qml. Bug is on Android.

    jsulmJ 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi!
      I have a Webview . Created a menu button with a pop-up menu. A Webview is always displayed above this menu, even if the menu is made in main.qml. Bug is on Android.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mikeeeeee Show your code, especially the part where you create webview...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3
        import QtQuick 2.12
        import QtQuick.Controls 2.12
        import QtWebView 1.13
        import QtQuick.Layouts 1.13
        import AppCore 1.0
        
        Item {
            //id:web_page
            property string url_d: ""
            property int id: 0
            property bool e_v: true
            property string text_sch: ""
            property bool empty_page: true
            property int tabs_caunt: 0
        
            WebView {
                id: webView
                //z: 1
                anchors
                {
                    top:tf_search_input.bottom
                    left: parent.left
                    right:parent.right
                    bottom:foot_layout.top
                }
                //        Component.onCompleted: {
                //        if(url_d=="")
                //        {
                //       url : initialUrl
                //            console.log("in func "+url_d)
                //        }
                //        else
                url: url_d
                //        }
                onLoadingChanged: {
                    if (loadRequest.errorString)
                    {
                        webView.url=utils.fromUserInput_text(text_sch)
                    }
                   // console.log(webView.title); //webView.title получать имя сайта
                 }
            }
        //    Rec
        //    {
        //        id:top_layout
        //        anchors
        //        {
        //            top: parent.top
        //            left: parent.left
        //            right:parent.right
        //        }
        //        enabled: e_v
        //        visible: e_v
                TextField
                {
                    id: tf_search_input
        
                    //Layout.preferredWidth:parent.width*0.9
                    height: 40
                    width: parent.width
                    text: webView.url
                    placeholderText: "Search"
        
                    anchors
                    {
                        top: parent.top
                        left: parent.left
                        right:parent.right
                    }
                    enabled: e_v
                    visible: e_v
        
                    onAccepted:
                    {
                        text_sch=text
                        empty_page=false
                        webView.url = utils.fromUserInput(text)
                    }
        
                    background: Rectangle
                    {
                        anchors.fill:parent
                        height: 40
                        radius:10
                        //color:Qt.lighter("grey")
                        border.color:"black"
                    }
                }
        
        
        
            RowLayout
            {
                id: foot_layout
                anchors
                {
                    left: parent.left
                    right: parent.right
                    bottom: parent.bottom
                }
                height: 40
                enabled: e_v
                visible: e_v
        
                ToolButton
                {
                    Layout.leftMargin: 15
                    id: btn_back_arrow
                   // height: 40
                   /// width: 40
                    icon.source: "qrc:/icons/icons8-arrowl-50.png"
                    background: Rectangle
                    {
                        anchors.fill: parent
                        color: "#00000000"
                    }
        //            Image {
        //                //anchors.fill: parent
        //                height: 40
        //                width: 40
        //                anchors.centerIn: parent
        //                source: "qrc:/icons/icons8-arrowl-50.png"
        //                //fillMode: Image.PreserveAspectFit
        //            }
        
                    onClicked: webView.goBack()
                    enabled: webView.canGoBack
                }
        
                ToolButton
                {
                    id: btn_forward_arrow
                    //height: 40
                    //width: 40
                    icon.source: "qrc:/icons/icons8-arrow-50.png"
        //            Image {
        //                height: 40
        //                width: 40
        //                anchors.centerIn: parent
        //                source: "qrc:/icons/icons8-arrow-50.png"
        //                fillMode: Image.Stretch
        //            }
                    background: Rectangle
                    {
                        anchors.fill: parent
                        color: "#00000000"
                    }
        
                    onClicked: webView.goForward()
                    enabled: webView.canGoForward
                }
        
                ToolButton
                {
                    id: btn_activ
        
                    height: 40
                    width: 40
        //            Image {
        //                height: 40
        //                width: 40
        //                anchors.centerIn: parent
        //                source: "qrc:/icons/qt.png"
        //                // fillMode: Image.Stretch
        //            }
                    text: tabs_caunt
                    //icon.name: text
                    //icon.source: "qrc:/icons/qt.png"
                    //enabled: true
        
        //            background: Rectangle
        //            {
        //                anchors.fill: parent
        //                color: "#00000000"
        //                border.color:"black"
        //                Label
        //                {
        //                    id: num_tabs
        //                    anchors.centerIn: parent
        //                    text:  tabs_caunt
        //                }
        //            }
        
        
                    onClicked:
                    {
                        e_v=false
                        if(id!=0)
                        {
                            loader.pop()
                        }
                        else
                        {
                            id=0
                            if(tf_search_input.text!="")
                            {
                            //AppCore.appendOpenTab(tf_search_input.text,webView.title)
        
                            }
                            loader.push("ListView1.qml")
                        }
                    }
                    // loader.push("ListView1.qml")
                }
        
                ToolButton
                        {
                            id: btn_settings
                            Layout.alignment: Qt.AlignRight
        
                            background: Rectangle
                            {
                                anchors.fill: parent
                                color: "#00000000"
                            }
                            icon.source: "qrc:/icons/menu.png"
                            onClicked: {
                                myMenu.open()
                                //console.log(btn_settings.height +" "+btn_settings.width)
                            }
        
                            Menu
                            {
                                id: myMenu
                                x: parent.width-width
                                y: parent.height - foot_layout.height - myMenu.height
                                z:1
                                transformOrigin: Menu.BottomRight
        
                                MenuItem
                                {
                                    text: "Copy Url"
                                    onTriggered: console.log("Copy Url")
                                }
        
                                MenuItem
                                {
                                    text:  "Translate Page"
                                    onTriggered: webView.url=("https://translate.google.com.ua/translate?sl=auto&tl=ru&u="+tf_search_input.text)
                                }
        
                                MenuItem
                                {
                                    text: "Downloads"
                                    onTriggered: loader.push("ListViewDownload.qml")
                                }
                            }
                        }
            }
        
            /*Menu {
                id:  myMenu
                x: parent.width
                y: parent.height //- foot_layout.height - myMenu.height
                z: 3
        
                MenuItem {
                    text:  "Copy Url"
                    onClicked:
                    {
                        console.log("Copy Url")
                        //loader.source = "MyDataWindow.qml"
                    }
                }
                MenuItem {
                    text:  "Translate Page"
                    onClicked:
                    {
                        webView.url=("https://translate.google.com.ua/translate?sl=auto&tl=ru&u="+tf_search_input.text)
                        //loader.source = "ChatWindow.qml"
                    }
                }
                MenuItem {
                    text:  "Downloads "
                    onClicked:
                    {
                        console.log("Downloads ")
                        //loader.source = "VideoWindow.qml"
                        loader.push("ListViewDownload.qml")
                    }
                }
        
            }*/
            //проверить на телефоне при рабочей бд
                Shortcut {
                    sequences: ["Back"]
                     enabled: webView.canGoBack
                    onActivated: {
                        onClicked: webView.goBack()
                        //enabled: webView.canGoBack
                    }
                }
        
                Shortcut
                {
                    sequence: "Menu"
                    onActivated: myMenu.open()
                }
        
            Pane {
                id: pane
                anchors.centerIn: parent
                anchors.top: tf_search_input.bottom
                anchors.bottom: foot_layout.top
                anchors.left: parent.left
                anchors.right: parent.right
                visible:(tf_search_input.activeFocus==true || empty_page==false) ? false : true
        
                Image {
                    id: logo
                    anchors.fill: parent
                    anchors.centerIn: parent
                    anchors.verticalCenterOffset: -50
                    fillMode: Image.Stretch
                    source: "qrc:/icons/78113.png"
                }
        
        
            }
        }
        
        
        1 Reply Last reply
        0
        • A Offline
          A Offline
          Augustas
          wrote on last edited by Augustas
          #4

          Same issue still persists on android, using Qt 5.14.2 and 5.15.2.
          But I guess it is simply not supported:
          https://bugreports.qt.io/browse/QTBUG-57667
          WebView documentation: "Due to platform limitations overlapping the WebView and other QML components is not supported."

          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