Hi,
Currently my application repeatedly plots points to the canvas, and I need to be able to select one of the points while new points are still being plotted. This is fine when WA_PaintOutsidePaintEvent is set to false. However, when I set it to true:
canvas()->setAttribute(WA_PaintOutsidePaintEvent, true);
The QEvent::MouseButtonPress inside of the EventFilter in CanvasPicker does not get activated until the points stop plotting. Furthermore, the QEvent::MouseMove event still gets triggered even when the points are still plotting. Here is the EventFilter function:
{
if ( object
!= (QObject *)plot
()->canvas
() ) return false;
switch(e->type())
{
showCursor(true);
showCursor(false);
{
break;
}
case QEvent::MouseButtonPress: {
// Only capture left click
{
return true;
}
}
// Gets called each time mouse is moved on canvas
{
return true;
}
default:
break;
}
return QObject::eventFilter(object, e
);
}
bool CanvasPicker::eventFilter(QObject *object, QEvent *e)
{
if ( object != (QObject *)plot()->canvas() )
return false;
switch(e->type())
{
case QEvent::FocusIn:
showCursor(true);
case QEvent::FocusOut:
showCursor(false);
case QEvent::Paint:
{
QApplication::postEvent(this, new QEvent(QEvent::User));
break;
}
case QEvent::MouseButtonPress:
{
// Only capture left click
if (((QMouseEvent *)e)->button() == (Qt::LeftButton))
{
select(((QMouseEvent *)e)->pos(), ((QMouseEvent *)e)->globalPos());
return true;
}
}
// Gets called each time mouse is moved on canvas
case QEvent::MouseMove:
{
return true;
}
default:
break;
}
return QObject::eventFilter(object, e);
}
To copy to clipboard, switch view to plain text mode
Can somebody please tell me how to get around this problem? (So I want to set WA_PaintOutsidePaintEvent true and have QEvent::MouseButtonPress get triggered while points are continuously plotting on the graph) Thank you.
Bookmarks