Vit Stepanek
8th December 2010, 12:32
Hi,
I have a "chart" view using QGraphicsView. Each line of data consists of few QGraphicsPathItems wrapped by a QGraphicsItemGroup. My intent is to highlight a data line when hovered by a mouse.
Here comes the problem: The hover events on the group are sent when I hover the rect of the line, but not the line itself (which is a curve). What's more, when more data lines go over each other, only the "top" one receives the hover event (due to z order).
I could implement a function which would iterate over points of the data lines, but don't want to reinvent a wheel in case I can do it simpler.
So, does anybody know a way how to detect that a cursor is above the curve itself, not only the rectangular area it's bounded by?
Thanks
Vit
I have a "chart" view using QGraphicsView. Each line of data consists of few QGraphicsPathItems wrapped by a QGraphicsItemGroup. My intent is to highlight a data line when hovered by a mouse.
Here comes the problem: The hover events on the group are sent when I hover the rect of the line, but not the line itself (which is a curve). What's more, when more data lines go over each other, only the "top" one receives the hover event (due to z order).
I could implement a function which would iterate over points of the data lines, but don't want to reinvent a wheel in case I can do it simpler.
So, does anybody know a way how to detect that a cursor is above the curve itself, not only the rectangular area it's bounded by?
Thanks
Vit