I realized there are a couple of errors in the code I posted. In the two case statements, if the mouse button press doesn't match the mouse pattern, then they get thrown away. This is wrong; the event should be passed up to the base class for it to handle instead. So, fix the code in both places by adding this:
{
switch( pEvent->type() )
{
case QEvent::MouseButtonPress: {
{
//... same as original code
}
else // These two lines are new; add the same thing to the double-click case
}
break;
default:
break;
}
return cmdList;
}
QwtPickerMachine::CommandList MyQwtPickerMachine::transition( const QwtEventPattern & eventPattern, const QEvent * pEvent )
{
QwtPickerMachine::CommandList cmdList;
switch( pEvent->type() )
{
case QEvent::MouseButtonPress:
{
if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, (const QMouseEvent *)pEvent ) )
{
//... same as original code
}
else // These two lines are new; add the same thing to the double-click case
cmdList = QwtPickerClickPointMachine::transition( eventPattern, pEvent );
}
break;
default:
cmdList = QwtPickerClickPointMachine::transition( eventPattern, pEvent );
break;
}
return cmdList;
}
To copy to clipboard, switch view to plain text mode
Bookmarks