PDA

View Full Version : QGraphicsProxyWidget and mouseEvents



qlands
11th November 2010, 15:45
Hi,

I have a QGraphicsProxyWidget with a button. Even thought I override the mousepress and mouserelease events of the proxy with event->ignore(); The button still receives the event and emits a pressed()

Any idea why or what do I need to do so so the button ignore the events? This without overriding the events of the button?

Thanks,
Carlos.

high_flyer
11th November 2010, 16:06
I might understood wrong, but I think you want to use accept() not ignore().
ignore() will progate the event further, you want to stop the event, so I think accept() should be used.

qlands
11th November 2010, 17:15
Hi,

Yes, the accept() works but now I run into another trouble:

The proxy item is embedded into a QGraphicsPolygonItem So it is Scene->Polygon->Proxy->Button

I did not override the press/release for the Polygon but I did it for the Proxy. This because I want to move the container (and the proxy inside it like a group) but not allow the user to click on the button. The problem is that with the override in the proxy the container cannot move!

Code of the proxy:


void tnkMatrix::mousePressEvent(QGraphicsSceneMouseEven t *event)
{
event->accept();
}

void tnkMatrix::mouseReleaseEvent(QGraphicsSceneMouseEv ent *event)
{
event->accept();
}


Any help is much appreciated.

Thanks,
Carlos.