QGraphicsItem mouse out of focus
Hey guys,
I want to emulate a "real button click" on a QGraphicsItem:
The click is triggered when mouse release + cursor inside.
Anyone could fill my blank here:
Code:
{
Q_D(qwListGraphicsItem);
if (/* cursor is not over the QGraphicsItem */ == true) return;
// Do something...
}
Thanks.
Re: QGraphicsItem mouse out of focus
What is a "real button click"? You will only get the release event if the cursor hits the shape() of the item. Is that "inside" enough?
Re: QGraphicsItem mouse out of focus
If you want your item to be shown as pressed,,, try to set its pos little by some offset while it is pressed.
Also you can change color of the item to give more realistic effect. Hope am getting u right ;)
Re: QGraphicsItem mouse out of focus
Solved : QGraphicsItem::isUnderMouse()
Code:
{
Q_D(qwListGraphicsItem);
if (isUnderMouse() == false) return;
// Do something...
}