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. Pressed mouse buttons
Qt 6.11 is out! See what's new in the release blog

Pressed mouse buttons

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.3k 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.
  • M Offline
    M Offline
    maksim1979
    wrote on last edited by
    #1

    Hello,

    Is there a way to find out pressed mouse buttons when the mouse cursor enter to a mouse area and when the button was clicked not under this mouse area? mouse.buttons and mouseArea.pressedButtons don't show information about pressed buttons.

    Thanks a lot,
    Maxim

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stevenceuppens
      wrote on last edited by
      #2

      Hi,

      @
      import QtQuick 2.0

      Rectangle {
      width: 360
      height: 360

      color: "blue"
      
      Rectangle {
          width: 100
          height: 100
      
          anchors.centerIn: parent
      
          color: "red"
      
          Text {
      
              anchors.centerIn: parent
          }
      
          MouseArea {
              id: mouse
      
              anchors.fill: parent
      
              onClicked: {
                  console.log("clicked red")
              }
          }
      }
      
      MouseArea {
          anchors.fill: parent
          propagateComposedEvents: true
          onClicked: {
              mouse.accepted = false
          }
      }
      

      }
      @

      Steven CEUPPENS
      Developer / Architect
      Mobile: +32 479 65 93 10

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        tip: use a

        @
        console.log("clicked blue")
        @

        in the last Mousarea too to get even more feedback from this setup.

        Qt Certified Specialist
        www.edalsolutions.be

        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