
Originally Posted by
zgulser
I have a QGraphicsScene object inside my QGraphicsView. So that's why I reimplemented mouse events in QGraphicsView. I did the following
void QGraphicsView::mousePressEvent(QMouseEvent* mouseEvent)
{
QPointF p = mapToScene(mouseEvent.x(), mouseEvent.y());
itemsList = this->scene.items(p);
...
}
I don't understand what you mean. What are you trying to achieve with that implementation?
How I am handling events in items? By reimplementing mouse events in QGraphicsItems?
Yes.
What do you mean by base class implementation?
I meant something like this:
void SubClass::function()
{
BaseClass::function(); // <-- call the base class implementation
// ... do your own things
}
void SubClass::function()
{
BaseClass::function(); // <-- call the base class implementation
// ... do your own things
}
To copy to clipboard, switch view to plain text mode
But looking at your current implementation, I'm not convinced at all you should even need to reimplement QGraphicsView::mousePressEvent().
Bookmarks