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. [solved] QDeclarativeItem wrong MouseArea
Forum Updated to NodeBB v4.3 + New Features

[solved] QDeclarativeItem wrong MouseArea

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 844 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
    glinbob
    wrote on last edited by
    #1

    Well i'm stupid i guess... :) It was indeed my qml fault, the problem was another element with a higher z value, which was hidden (visible = true, but height=0) but still it seems to get the mouse events neither does it propagate them...

    Hello everyone,

    i'm currently struggling with the following:
    given a QDeclarativeItem subclass displayed via a custom QDeclarativeView which just loads a qml file. The component looks fine and as expected, it also gets mouse events, to some extent, thats where the problem is:
    the mousePressEvent is not triggered/emitted for the whole visible rectangle. boundingRect(), and shape().boundingRect() look correct to me, both are somewhat like [0,0,width(),height()] with the correct values, this->sceneBoundingRect() also returns what one would expect, the same width/height but translated x,y values for the actual position.

    In short, my button component is only clickable in some part of it, in this particular example just in the lower half. It's not about translated/transforming the mouse event, because the slot isn't even called.
    I also tried to set the component's z-property to some high value to ensure there is no other component 'stealing' the mouse events.
    I suppose i'm missing some signal i should react to or some slot i should override? Or is it a problem on the qml side, where my lets say component hierarchy/layout/anchoring is broken?

    as an edit/update, even more confusing: while the mouse rect for the press event is wrong, mouse move events works perfect. That is after you press and hold the mouse, moving the mouse in and out (with button still pressed) works fine with respect to the actual visible shape... thats weird?!

    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