/*
* Event handler for the any widget using the installEventFilter function
*/
bool VideoViewerWindow
::eventFilter( QObject *obj,
QEvent *event
) {
if( obj == mpVideoPlayer )
{
// Mouse Button Release handlers
if( event
->type
() == QEvent::MouseButtonRelease ) {
AzElPoint point;
QMouseEvent *mouseEvent
= static_cast<QMouseEvent
*>
(event
);
point.frameNumber = getCurrentFrame( );
point.xPos = mouseEvent->x( );
point.yPos = mouseEvent->y( );
if( mouseEvent->button() == Qt::LeftButton )
{
// If left button, place mark on overlay to indicate position
// and store position in array at the current frame index
azElPoints.push_back( point );
printf( "x=%d, y=%d\n", point.xPos, point.yPos );
mpVideoPainter->drawPoint( point.xPos, point.yPos );
return true;
}
else if( mouseEvent->button() == Qt::RightButton )
{
// If right button, remove any point located in current frame
azElPoints.push_back( point );
printf( "x=%d, y=%d\n", point.xPos, point.yPos );
return true;
}
}
}
if( event
->type
() == QEvent::Paint || event
->type
( ) == QEvent::Move ) {
if( pMediaSeeking != NULL )
{
repaintWindow( );
painter.
setPen( QPen( Qt
::red ) );
for( int i = 0 ; i < azElPoints.size( ) ; i++ )
{
if( azElPoints[i].frameNumber == getCurrentFrame( ) )
{
painter.drawPoint( azElPoints[i].xPos, azElPoints[i].yPos );
}
}
}
}
return QObject::eventFilter( obj, event
);
}