1. GraphicsPolygonItem subclass of QGraphicsPolygonItem; GraphicsView subclass of QGraphicsView;
2. There are two GraphicsPolygonItem items(we call them item-A item-B) in the scene(GraphicsView hold the scene);
3. I can doubleclick to select one item(item-A), but when I doubleclick the other(item-B), it doing nothing. But, I doubleclick item-B once again, item-B will be selected. It means I have to doubleclick twice to switch and select the other. Yes, it is switch and select, because if i only click item-A, it don't need doubleclick twice.
4. I have debug it as, when I doubleclick the other item, it will not come into the GraphicsPolygonItem::mouseDoubleClickEvent(QGraphi csSceneMouseEvent *event).
here is the code: //GraphicsPolygonItem
{
/*here doing some thing for select item......*/
//...
this->QGraphicsPolygonItem::update();
}
void GraphicsPolygonItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
/*here doing some thing for select item......*/
//...
this->QGraphicsPolygonItem::update();
QGraphicsPolygonItem::mouseDoubleClickEvent(event);
}
To copy to clipboard, switch view to plain text mode
//GraphicsView
void GraphicView
::mouseDoubleClickEvent(QMouseEvent *event
) {
}
void GraphicView::mouseDoubleClickEvent(QMouseEvent *event)
{
QGraphicsView::mouseDoubleClickEvent(event);
}
To copy to clipboard, switch view to plain text mode
Be expecting your response! Thanks!
Bookmarks