Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QML WebEngineView: how to prohibit user interactions?
Forum Updated to NodeBB v4.3 + New Features

QML WebEngineView: how to prohibit user interactions?

Scheduled Pinned Locked Moved Unsolved Qt WebKit
2 Posts 1 Posters 1.4k 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.
  • V Offline
    V Offline
    VTiTux
    wrote on last edited by VTiTux
    #1

    Hello,
    I would like to show a web page to my application, but my user shall not modify anything.
    For mouse events, I stack an invisible item that caught all events, but for the keyboard, I cannot disable the focus of my WebEngineView:

    import QtQuick 2.0
    import QtQuick.Window 2.0
    import QtWebEngine 1.3
    
    Window {
        width: 1024
        height: 750
        visible: true
    
    
        Item{
            anchors.fill: parent
            focus: false
            Keys.enabled: false
    
            Keys.onPressed: {
                console.log("key locked")
                event.accepted = true
            }
    
            WebEngineView{
                anchors.fill: parent
                url: "https://forum.qt.io"
                z: 0
                focus: false
                Keys.enabled: false
    
                Item{
                    id: lockScreen1
                    anchors.fill: parent
                    z: 1
                    enabled: true
                    visible: true
                    focus: true
                    Keys.enabled: true
    
                    Keys.onPressed: {
                        console.log("key locked")
                        event.accepted = true
                    }
                }
            }
    
            Item{
                id: lockScreen2
                anchors.fill: parent
                z: 1
                enabled: true
                visible: true
                focus: true
                Keys.enabled: true
    
                Keys.onPressed: {
                    console.log("key locked")
                    event.accepted = true
                }
    
                MouseArea{
                    anchors.fill: parent
                    onWheel: {}
                }
                MultiPointTouchArea{
                    anchors.fill: parent
                }
                PinchArea{
                    anchors.fill: parent
                }
            }
    
        }
    }
    
    

    How to do that?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VTiTux
      wrote on last edited by VTiTux
      #2

      I added

                  onFocusChanged: {
                          lockScreen2.forceActiveFocus()
                  }
      

      into my WebEngineView.
      This works, except for the first 'tab' pressed, which scroll my view to top.

      Another idea?

      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