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. Create dummy MouseEvent in QML
Forum Updated to NodeBB v4.3 + New Features

Create dummy MouseEvent in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 250 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.
  • vikramgV Offline
    vikramgV Offline
    vikramg
    wrote on last edited by
    #1

    I have in my application a MouseArea for screensaver functionality:

        MouseArea {
            id: screenSaverTouchArea
            anchors.fill: parent
            onPressed: {
                var consumeEvent = false // Set to true to prevent propagation of touch
                . . . screen saver functionality . . .
                if (condition) {
                    . . . 
                    // Don't propagate touch here
                    consumeEvent = true
                }
                . . .
                mouse.accepted = consumeEvent  // Set to false to propagate this event down
            }
        }
    

    mouse.accepted is set based on whether I want the event to propagate down or not. Now I would also like the screen to be awakened from a different non-touch event in my app. The easiest way would be to call screenSaverTouchArea.onPressed() when that event happens:

    function ssOnEvent() {
        screenSaverTouchArea.onPressed()
    }
    

    But that results in Error: Insufficient arguments. Is there a way to create a dummy MouseEvent in QML with some off-screen x/y touch coordinates and call the onPressed handler with that as the argument?

    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