Exemplo n.º 1
0
/*!
   Qt::MidButton zooms out one position on the zoom stack,
   Qt::RightButton to the zoom base.

   Changes the current position on the stack, but doesn't pop
   any rectangle.

   \note The mouse events can be changed, using
         QwtEventPattern::setMousePattern: 2, 1
*/
void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent *me )
{
    if ( mouseMatch( MouseSelect2, me ) )
        zoom( 0 );
    else if ( mouseMatch( MouseSelect3, me ) )
        zoom( -1 );
    else if ( mouseMatch( MouseSelect6, me ) )
        zoom( +1 );
    else
        QwtPlotPicker::widgetMouseReleaseEvent( me );
}
Exemplo n.º 2
0
/*!
  \brief Compare a mouse event with an event pattern.

  A mouse event matches the pattern when both have the same button
  value and in the state value the same key flags(Qt::KeyButtonMask)
  are set.

  \param code Index of the event pattern
  \param event Mouse event
  \return true if matches

  \sa keyMatch()
*/
bool QwtEventPattern::mouseMatch( MousePatternCode code, 
    const QMouseEvent *event ) const
{
    if ( code >= 0 && code < MousePatternCount )
        return mouseMatch( d_mousePattern[ code ], event );

    return false;
}
Exemplo n.º 3
0
/*!
  \brief Compare a mouse event with an event pattern.

  A mouse event matches the pattern when both have the same button
  value and in the state value the same key flags(Qt::KeyButtonMask)
  are set.

  \param pattern Index of the event pattern
  \param e Mouse event
  \return true if matches

  \sa keyMatch()
*/
bool QwtEventPattern::mouseMatch(uint pattern, const QMouseEvent *e) const
{
    bool ok = false;

    if ( e && pattern < (uint)d_mousePattern.count() )
        ok = mouseMatch(d_mousePattern[int(pattern)], e);

    return ok;
}
Exemplo n.º 4
0
void PlotZoomer::widgetMouseReleaseEvent(QMouseEvent *event)
{
  if (mouseMatch(MouseSelect3, event))
  {
    // Panner handles middle button.
    return;
  }

  QwtPlotZoomer::widgetMouseReleaseEvent(event);
  if (mouseMatch(MouseSelect2, event))
  {
    if (_contextMenuExpectedSeq == _contextMenuSequenceNumber)
    {
      ++_contextMenuSequenceNumber;
      zoomToFit();
    }
  }
}
Exemplo n.º 5
0
void PlotZoomer::widgetMousePressEvent(QMouseEvent *event)
{
  if (mouseMatch(MouseSelect2, event))
  {
    _contextMenuExpectedSeq = ++_contextMenuSequenceNumber;
    //QTimer::singleShot(_contextMenuTimeMs, this, &PlotZoomer::contextMenuTimeout);
    QTimer::singleShot(_contextMenuTimeMs, this, SLOT(contextMenuTimeout()));
  }
  Super::widgetMousePressEvent(event);
}