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. How can I propagate onPositionChanged() to a child MouseArea?
Forum Updated to NodeBB v4.3 + New Features

How can I propagate onPositionChanged() to a child MouseArea?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 583 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.
  • C Offline
    C Offline
    cscooper
    wrote on 3 Dec 2014, 17:18 last edited by
    #1

    I've got two overlapping MouseAreas, let's say the big one is at ((0, 0),(100,100)) and the small one is at ((40,40),(50,50)). They both need to get "onPositionChanged" messages.

    I can set propagateComposedEvents to true, but positionChanged isn't a composed event (right?) so it doesn't help.

    This whole problem might be because the child MouseArea is inside the rowDelegate of a TableView, and all kinds of things get screwy when you have objects inside of Loaders.

    What I am trying now, is to subclass MouseArea with ParentMouseArea, changing the big MouseArea to be a ParentMouseArea, and having the small MouseArea register itself with the ParentMouseArea. Then, when ParentMouseArea gets the onPositionChanged(), it can look through its list of child MouseAreas and pass the message on to its children.

    This working, except that of course the QQuickMouseEvent being passed to the ParentMouseArea's onPositionChanged() is reporting the mouse coordinates in the ParentMouseArea's coordinate system, and I need to convert them to the child MouseArea's coordinate system before passing them on, and the 'x' and 'y' parameters on QQuickMouseEvent are read-only.

    I can call mapToItem() to convert the x and y values to the correct coordinate system, but then I can' do anything useful with the next values.

    Is there a way to create a new QQuickMouseEvent with the converted values? Or am I barking up the completely wrong tree?

    Thanks,
    Chris

    1 Reply Last reply
    0

    1/1

    3 Dec 2014, 17:18

    • Login

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