Important: Please read the Qt Code of Conduct -

OnMouseRelease does not trigger

  • Hi,

    I have the visualization of a graph, with big round vertices and some edges connecting these. The Graph is a QGraphicsScene. Vertices and Edges are QGraphicsPolygonItem's.
    I did not write this software; the original author is unavailable and I was tasked to maintain it and fix a few bugs.

    The problem is that when a vertex or edge is clicked with the mouse something is supposed to happen. For vertices this works like a charm, but for edges nothing is happening right now.
    I sprinkled a few debug messages throughout the code and found out, that the onMouseRelease method for Edges is never being called. This is very strange to me because the onMousePress method works as intended.
    So at some point the release event is lost but I dont know why and I dont know where.

    Unfortunately I am fairly new to Qt and never worked much with it before. I guess I would have to read through all kinds of documentations before I can fully grasp the core of this problem and work on a solution.
    My hope is, that maybe someone here can point me in the right direction to save me some trouble.

    I would really appreciate any kind of info on this, thank you very much.

  • bump. Anyone?

  • If anyone is having the same problem here is the solution I found after reading all kinds of documentations:
    The graphics item needs to have the flag "selectable" enabled. Otherwise no onMouseRelease events will ever be fired for this graphics item.

Log in to reply