Results 1 to 2 of 2

Thread: Overlapping Mouse Areas

  1. #1
    Join Date
    Mar 2015
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Question Overlapping Mouse Areas

    Hello all,

    MouseArea of blueRectangle is disabled.
    When blueRectangle is clicked , yellowRectangle receives onClicked. Why is this happening ?
    How can I do when MouseArea of blueRectangle is disabled and I clicked on this the yellowRectangle does not receives onClicked.

    Qt Code:
    1. Rectangle {
    2. id: yellowRectangle
    3. color: "yellow"
    4. width: 100; height: 100
    5.  
    6. MouseArea {
    7. anchors.fill: parent
    8. onClicked: console.log("clicked yellow")
    9. }
    10.  
    11. Rectangle {
    12. id: blueRectangle
    13. color: "blue"
    14. width: 50; height: 50
    15.  
    16. MouseArea {
    17. anchors.fill: parent
    18. enabled: false
    19. onClicked: {
    20. console.log("clicked blue")
    21. mouse.accepted = false
    22. }
    23. }
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Overlapping Mouse Areas

    Quote Originally Posted by piplex View Post
    Hello all,

    MouseArea of blueRectangle is disabled.
    When blueRectangle is clicked , yellowRectangle receives onClicked. Why is this happening ?
    That's because the other mouse area is disabled.
    How can I do when MouseArea of blueRectangle is disabled and I clicked on this the yellowRectangle does not receives onClicked.
    Don't disable the mouse area, just don't act on its event.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QImage getting black areas for GIF frames
    By elephant in forum Qt Programming
    Replies: 4
    Last Post: 7th December 2013, 00:29
  2. Replies: 8
    Last Post: 13th May 2013, 14:36
  3. mouse selection of overlapping ellipses
    By imagyne in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2011, 08:59
  4. How to make certain areas transparent with the desktop?
    By Sir Rogers in forum Qt Programming
    Replies: 5
    Last Post: 11th May 2010, 22:08
  5. Replies: 0
    Last Post: 1st September 2009, 09:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.