[Solved] Strange problem with QGraphicsScene and a popup QDialog
-
Hi, i create a QGraphicScene that have 3 object inside. This object is Service, the service is derived from PixmapItemAnimation, a simple QGraphicsPixmapItem with some animation. I want click on the Service object and open a QDialog.
I use signal mousePressEvent from Service and connect to a slot servicePressed() on Home class. In the slot i use a qDebug() << id_service, to know what Service object is pressed. If i try click on it i correctly receive the id_service of the object. But if i open a QDialog and close. After a click on every zone of QGraphicScene generate a signal mousePressEvent with the latest id_service that have open the QDialog!!! It's incredible!
If you have time look the source code... try this:
1)click on object1 ...you get a normal id_service 1
2)click object2 you get a QDialog...
3) click on object1 or every zone of QGraphicScene...you get the previous QDialog!Someone can help me from this issue?
Thank'sthis is the "zip file":https://www.dropbox.com/sh/htwdn3dy84ek5is/q24VStCphJ
-
Hi!
Looks like event is not processed correctly.
If you change to:
@void Service::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
emit buttonPressed(id_service);PixmapItemAnimation::mousePressEvent(event);
}@
It'll work.Regards,
Jake -
Thank's you Jake007 now works perfect!