Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Having a "pass-through" MouseArea on a WebEngineView
Forum Updated to NodeBB v4.3 + New Features

Having a "pass-through" MouseArea on a WebEngineView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 513 Views 1 Watching
  • 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.
  • LorenDBL Offline
    LorenDBL Offline
    LorenDB
    wrote on last edited by
    #1

    I need to track whether the user has recently moved the mouse in my app. This app contains a WebEngineView. I currently have this code in the middle of my app; I've added imports to make it a complete program:

    import QtQuick 2.12
    import QtWebEngine 1.8
    
    WebEngineView {
        url: "https://example.com"
    
        MouseArea {
            anchors.fill: parent
            z: parent.z + 1
            hoverEnabled: true
            propagateComposedEvents: true
    
            onPositionChanged: {
                mouse.accepted = false
                logoutTimer.restart()
            }
    
            onPressed: {
                mouse.accepted = false
                logoutTimer.restart()
            }
    
            onReleased: {
                mouse.accepted = false
                logoutTimer.restart()
            }
    
            onHoveredChanged: {
                mouse.accepted = false
                logoutTimer.restart()
            }
        }
    }
    

    Unfortunately, this only propogates click events to the WebEngineView, which removes any possibility of hover effects or changing the cursor to a pointing-hand-link-style cursor. I understand that hover events aren't affected by changing mouse.accepted.

    I'm on Qt 5.15.2 on openSUSE Tumbleweed.

    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