PDA

View Full Version : Disable MouseEvent function



2lights
26th August 2013, 11:34
Good Day,

Subclassed QGraphicsView
Created functions for mouseMove & mousePressed events accordingly

after that a user must be given the option to move the image in graphicsView
how do I disable the mouseEvent functions so the user can move the image


newImage2->setFlag(QGraphicsItem::ItemIsMovable); // this does not work because the mouse events were overridden

Is there a way I can create a Toggle button of sorts to decide which mouseEvent must be called

Ideas please
Kind Regards

wysota
26th August 2013, 11:39
Call the base class implementation from your event handler.

wagmare
26th August 2013, 11:39
use event filter with mouseevent ..


bool Window::eventFilter(QObject *watched, QEvent* e)
{
if (watched == chatEdit && e->type() == QEvent::MouseEvent) {
/** ignore it */
return true;
}
}
return QWidget::eventFilter(watched, e);
}

and dont forget to install it and remove whenever it required ..
view->installEventFilter(this);