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. Forwarding mouse events
Forum Updated to NodeBB v4.3 + New Features

Forwarding mouse events

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 4.2k 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.
  • G Offline
    G Offline
    goli
    wrote on last edited by
    #1

    I need to create 2 MouseArea's - one above the other, and i want that
    both of them will get the signal pressed.

    something like this:

    @
    MouseArea
    {
    id: mouseArea1
    anchors.fill: parent

        onPressed:
        {
            console.log("onPressed 1")
            mouse.accepted = false;
        }
    }
    
    MouseArea
    {
        id: mouseArea2
        anchors.fill: parent
    
    
        onPressed:
        {
            console.log("onPressed 2")
           // this is not accepted(only clicked, and this is not what i need)
            mouseArea1["pressed"](mouse);         
        }
    

    }
    @

    any idea?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      X-Krys
      wrote on last edited by
      #2

      Since mouseArea2 is on top of mouseArea1 you've to forward the event from mouseArea2

      @

      MouseArea
      {
      id: mouseArea1
      anchors.fill: parent

          onPressed:
          {
              console.log("onPressed 1")
           }
      }
      
      MouseArea
      {
          id: mouseArea2
          anchors.fill: parent
      
      
          onPressed:
          {
              console.log("onPressed 2")
              mouse.accepted = false;
          }
      }
      

      @

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved