/*! \brief Mouse press event handler Start movement of the wheel. \param event Mouse event */ void QwtWheel::mousePressEvent( QMouseEvent *event ) { stopFlying(); d_data->isScrolling = wheelRect().contains( event->pos() ); if ( d_data->isScrolling ) { d_data->time.start(); d_data->speed = 0.0; d_data->mouseValue = valueAt( event->pos() ); d_data->mouseOffset = d_data->mouseValue - d_data->value; d_data->pendingValueChanged = false; Q_EMIT wheelPressed(); } }
void SoQtThumbWheel::mousePressEvent(QMouseEvent * event) { if (this->state != SoQtThumbWheel::Idle) return; if (event->button() != Qt::LeftButton) return; QRect wheelrect; if (this->orient == Vertical) { wheelrect.setLeft(SHADEBORDERWIDTH + 3); wheelrect.setTop(SHADEBORDERWIDTH + 6); wheelrect.setRight(this->width() - SHADEBORDERWIDTH - 3); wheelrect.setBottom(this->height() - SHADEBORDERWIDTH - 6); } else { wheelrect.setLeft(SHADEBORDERWIDTH + 6); wheelrect.setTop(SHADEBORDERWIDTH + 3); wheelrect.setRight(this->width() - SHADEBORDERWIDTH - 6); wheelrect.setBottom(this->height() - SHADEBORDERWIDTH - 3); } if (!wheelrect.contains(event->pos())) return; this->state = SoQtThumbWheel::Dragging; if (this->orient == SoQtThumbWheel::Vertical) this->mouseDownPos = event->pos().y() - SHADEBORDERWIDTH - 6; else this->mouseDownPos = event->pos().x() - SHADEBORDERWIDTH - 6; this->mouseLastPos = this->mouseDownPos; emit wheelPressed(); }