Unsolved QML WebEngineView: how to prohibit user interactions?
-
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?
-
I added
onFocusChanged: { lockScreen2.forceActiveFocus() }
into my WebEngineView.
This works, except for the first 'tab' pressed, which scroll my view to top.Another idea?