/*!
  Handle a mouse release event for the observed widget.

  \param me Mouse event
  \sa eventFilter(), widgetMousePressEvent(),
      widgetMouseMoveEvent(),
*/
void QwtPanner::widgetMouseReleaseEvent(QMouseEvent *me)
{
    if ( isVisible() )
    {
        hide();
#ifndef QT_NO_CURSOR
        showCursor(false);
#endif

        QPoint pos = me->pos();
        if ( !isOrientationEnabled(Qt::Horizontal) )
            pos.setX(d_data->initialPos.x());
        if ( !isOrientationEnabled(Qt::Vertical) )
            pos.setY(d_data->initialPos.y());

        d_data->pixmap = QPixmap();
        d_data->pos = pos;

        if ( d_data->pos != d_data->initialPos )
        {
            emit panned(d_data->pos.x() - d_data->initialPos.x(), 
                d_data->pos.y() - d_data->initialPos.y());
        }
    }
}
Example #2
0
int QwtPanner::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: panned((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 1: moved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
Example #3
0
/*!
  Handle a mouse move event for the observed widget.

  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
*/
void QwtPanner::widgetMouseReleaseEvent(QMouseEvent *me)
{
    if ( isVisible() )
    {
        hide();
#ifndef QT_NO_CURSOR
        showCursor(false);
#endif

        d_data->pixmap = QPixmap();
        d_data->pos = me->pos();

        if ( d_data->pos != d_data->initialPos )
        {
            emit panned(d_data->pos.x() - d_data->initialPos.x(),
                        d_data->pos.y() - d_data->initialPos.y());
        }
    }
}