本文整理汇总了C++中QwtEventPattern类的典型用法代码示例。如果您正苦于以下问题:C++ QwtEventPattern类的具体用法?C++ QwtEventPattern怎么用?C++ QwtEventPattern使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QwtEventPattern类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//! Transition
QList<QwtPickerMachine::Command> QwtPickerClickPointMachine::transition(
const QwtEventPattern &eventPattern, const QEvent *e )
{
QList<QwtPickerMachine::Command> cmdList;
switch ( e->type() )
{
case QEvent::MouseButtonPress:
{
if ( eventPattern.mouseMatch(
QwtEventPattern::MouseSelect1, ( const QMouseEvent * )e ) )
{
cmdList += Begin;
cmdList += Append;
cmdList += End;
}
break;
}
case QEvent::KeyPress:
{
if ( eventPattern.keyMatch(
QwtEventPattern::KeySelect1, ( const QKeyEvent * )e ) )
{
cmdList += Begin;
cmdList += Append;
cmdList += End;
}
break;
}
default:
break;
}
return cmdList;
}
示例2: transition
virtual QList<Command> transition(const QwtEventPattern& eventPattern, const QEvent* e)
{
QList<Command> cmdList;
switch(e->type())
{
case QEvent::MouseButtonPress:
{
const QMouseEvent *mouseEvent = (QMouseEvent*)e;
if(eventPattern.mouseMatch(QwtEventPattern::MouseSelect1, mouseEvent)
|| (mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::ControlModifier)
|| (mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::ShiftModifier))
{
if(state() == 0)
{
cmdList += Begin;
cmdList += Append;
cmdList += Append;
setState(2);
}
if(mouseEvent->modifiers() == Qt::ControlModifier || mouseEvent->modifiers() == Qt::ShiftModifier)
m_bAddToSelection = true;
else
m_bAddToSelection = false;
}
break;
}
case QEvent::MouseMove:
case QEvent::Wheel:
{
if ( state() != 0 )
cmdList += Move;
break;
}
case QEvent::MouseButtonRelease:
{
if ( state() == 2 )
{
cmdList += End;
setState(0);
}
break;
}
case QEvent::KeyPress:
{
if(eventPattern.keyMatch(QwtEventPattern::KeySelect1, (const QKeyEvent *)e))
{
if ( state() == 0 )
{
cmdList += Begin;
cmdList += Append;
cmdList += Append;
setState(2);
}
else
{
cmdList += End;
setState(0);
}
}
break;
}
default:
break;
}
return cmdList;
}
示例3: switch
//! Transition
QList<QwtPickerMachine::Command> QwtPickerDragLineMachine::transition(
const QwtEventPattern &eventPattern, const QEvent *event )
{
QList<QwtPickerMachine::Command> cmdList;
switch( event->type() )
{
case QEvent::MouseButtonPress:
{
if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
static_cast<const QMouseEvent *>( event ) ) )
{
if ( state() == 0 )
{
cmdList += Begin;
cmdList += Append;
cmdList += Append;
setState( 1 );
}
}
break;
}
case QEvent::KeyPress:
{
if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1,
static_cast<const QKeyEvent *> ( event ) ) )
{
if ( state() == 0 )
{
cmdList += Begin;
cmdList += Append;
cmdList += Append;
setState( 1 );
}
else
{
cmdList += End;
setState( 0 );
}
}
break;
}
case QEvent::MouseMove:
case QEvent::Wheel:
{
if ( state() != 0 )
cmdList += Move;
break;
}
case QEvent::MouseButtonRelease:
{
if ( state() != 0 )
{
cmdList += End;
setState( 0 );
}
}
default:
break;
}
return cmdList;
}