mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 18:01:08 -06:00
Qt6: Fix QMouseEvent.x() and .y() deprecation.
This commit is contained in:
parent
a04d41b043
commit
835cf4a53c
@ -137,7 +137,7 @@ bool RicBoxManipulatorEventHandler::eventFilter( QObject* obj, QEvent* inputEven
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
cvf::ref<cvf::RayIntersectSpec> rayIS =
|
||||
viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(), mouseEvent->pos().y() );
|
||||
viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->position().x(), mouseEvent->position().y() );
|
||||
|
||||
if ( rayIS.notNull() )
|
||||
{
|
||||
|
@ -128,8 +128,9 @@ bool RicPointTangentManipulator::eventFilter( QObject* obj, QEvent* inputEvent )
|
||||
{
|
||||
auto* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
cvf::ref<cvf::RayIntersectSpec> rayIs =
|
||||
m_viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(), mouseEvent->pos().y(), m_isDraggingInComparisonView );
|
||||
cvf::ref<cvf::RayIntersectSpec> rayIs = m_viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->position().x(),
|
||||
mouseEvent->position().y(),
|
||||
m_isDraggingInComparisonView );
|
||||
|
||||
if ( !rayIs.isNull() && rayIs->ray() )
|
||||
{
|
||||
|
@ -1076,8 +1076,8 @@ void RiuViewer::mouseMoveEvent( QMouseEvent* mouseEvent )
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
if ( viewLinker )
|
||||
{
|
||||
int translatedMousePosX = mouseEvent->pos().x();
|
||||
int translatedMousePosY = height() - mouseEvent->pos().y();
|
||||
int translatedMousePosX = mouseEvent->position().x();
|
||||
int translatedMousePosY = height() - mouseEvent->position().y();
|
||||
|
||||
cvf::Vec3d displayCoord( 0, 0, 0 );
|
||||
if ( mainCamera()->unproject( cvf::Vec3d( static_cast<double>( translatedMousePosX ), static_cast<double>( translatedMousePosY ), 0 ),
|
||||
|
@ -139,11 +139,11 @@ void RiuWellLogTrack::onMouseMoveEvent( QMouseEvent* mouseEvent )
|
||||
double depth = 0.0;
|
||||
if ( depthTrackPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
|
||||
{
|
||||
depth = axisMap.invTransform( mouseEvent->pos().x() );
|
||||
depth = axisMap.invTransform( mouseEvent->position().x() );
|
||||
}
|
||||
else
|
||||
{
|
||||
depth = axisMap.invTransform( mouseEvent->pos().y() );
|
||||
depth = axisMap.invTransform( mouseEvent->position().y() );
|
||||
}
|
||||
|
||||
depthTrackPlot->setDepthMarkerPosition( depth );
|
||||
|
@ -91,8 +91,8 @@ void QtMouseState::updateFromMouseEvent( QMouseEvent* event )
|
||||
if ( numMouseButtonsInState( m_mouseButtonState ) == 1 )
|
||||
{
|
||||
m_cleanButtonPressButton = buttonPressed;
|
||||
m_cleanButtonPressPosX = event->x();
|
||||
m_cleanButtonPressPosY = event->y();
|
||||
m_cleanButtonPressPosX = event->position().x();
|
||||
m_cleanButtonPressPosY = event->position().y();
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,8 +109,10 @@ void QtMouseState::updateFromMouseEvent( QMouseEvent* event )
|
||||
m_cleanButtonPressPosY != cvf::UNDEFINED_INT )
|
||||
{
|
||||
// We have a candidate, check if movement is within tolerance
|
||||
if ( cvf::Math::abs( double( ( m_cleanButtonPressPosX - event->x() ) ) ) <= m_cleanButtonClickTolerance &&
|
||||
cvf::Math::abs( double( ( m_cleanButtonPressPosY - event->y() ) ) ) <= m_cleanButtonClickTolerance )
|
||||
if ( cvf::Math::abs( double( ( m_cleanButtonPressPosX - event->position().x() ) ) ) <=
|
||||
m_cleanButtonClickTolerance &&
|
||||
cvf::Math::abs( double( ( m_cleanButtonPressPosY - event->position().y() ) ) ) <=
|
||||
m_cleanButtonClickTolerance )
|
||||
{
|
||||
m_cleanButtonClickButton = buttonReleased;
|
||||
}
|
||||
|
@ -72,11 +72,11 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
if ( me->button() == Qt::MiddleButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() )
|
||||
{
|
||||
this->pickAndSetPointOfInterest( me->x(), me->y() );
|
||||
this->pickAndSetPointOfInterest( me->position().x(), me->position().y() );
|
||||
|
||||
m_trackball->startNavigation( cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY );
|
||||
m_roationSensitivityCalculator.init( me );
|
||||
@ -120,7 +120,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
if ( m_isNavigating )
|
||||
{
|
||||
|
@ -141,8 +141,8 @@ void caf::CeetronNavigation::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
if ( !m_viewer->canRender() ) return;
|
||||
initializeRotationCenter();
|
||||
int posX = event->x();
|
||||
int posY = m_viewer->height() - event->y();
|
||||
int posX = event->position().x();
|
||||
int posY = m_viewer->height() - event->position().y();
|
||||
|
||||
ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() );
|
||||
if ( navType != m_trackball->activeNavigation() )
|
||||
@ -166,8 +166,8 @@ void caf::CeetronNavigation::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
if ( !m_viewer->canRender() ) return;
|
||||
initializeRotationCenter();
|
||||
int posX = event->x();
|
||||
int posY = m_viewer->height() - event->y();
|
||||
int posX = event->position().x();
|
||||
int posY = m_viewer->height() - event->position().y();
|
||||
|
||||
ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() );
|
||||
m_trackball->startNavigation( navType, posX, posY );
|
||||
@ -183,7 +183,7 @@ void caf::CeetronNavigation::mouseReleaseEvent( QMouseEvent* event )
|
||||
if ( !m_viewer->canRender() ) return;
|
||||
initializeRotationCenter();
|
||||
ManipulatorTrackball::NavigationType navType = getNavigationTypeFromMouseButtons( event->buttons() );
|
||||
m_trackball->startNavigation( navType, event->x(), event->y() );
|
||||
m_trackball->startNavigation( navType, event->position().x(), event->position().y() );
|
||||
|
||||
setCursorFromCurrentState();
|
||||
}
|
||||
|
@ -75,11 +75,11 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
if ( me->button() == Qt::RightButton && isRotationEnabled() )
|
||||
{
|
||||
this->pickAndSetPointOfInterest( me->x(), me->y() );
|
||||
this->pickAndSetPointOfInterest( me->position().x(), me->position().y() );
|
||||
|
||||
m_trackball->startNavigation( cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY );
|
||||
m_roationSensitivityCalculator.init( me );
|
||||
@ -103,8 +103,8 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
if ( me->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
QMouseEvent* we = static_cast<QMouseEvent*>( inputEvent );
|
||||
m_lastPosX = we->x();
|
||||
m_lastPosY = we->y();
|
||||
m_lastPosX = we->position().x();
|
||||
m_lastPosY = we->position().y();
|
||||
|
||||
m_zoomRay = createZoomRay( translatedMousePosX, translatedMousePosY );
|
||||
|
||||
@ -150,16 +150,16 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( me->position().x(), me->position().y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
if ( m_isNavigating )
|
||||
{
|
||||
if ( m_isZooming )
|
||||
{
|
||||
int delta = 3 * ( m_lastPosY - me->y() );
|
||||
int delta = 3 * ( m_lastPosY - me->position().y() );
|
||||
this->zoomAlongRay( m_zoomRay.p(), delta );
|
||||
m_lastPosX = me->x();
|
||||
m_lastPosY = me->y();
|
||||
m_lastPosX = me->position().x();
|
||||
m_lastPosY = me->position().y();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -332,8 +332,8 @@ bool caf::TrackBallBasedNavigation::shouldRaytraceForNewPoiDuringWheelZoom( int
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::RotationSensitivityCalculator::init( QMouseEvent* eventAtRotationStart )
|
||||
{
|
||||
m_lastPosX = eventAtRotationStart->x();
|
||||
m_lastPosY = eventAtRotationStart->y();
|
||||
m_lastPosX = eventAtRotationStart->position().x();
|
||||
m_lastPosY = eventAtRotationStart->position().y();
|
||||
|
||||
m_lastTime = eventAtRotationStart->timestamp();
|
||||
}
|
||||
@ -353,8 +353,8 @@ double caf::RotationSensitivityCalculator::calculateSensitivity( QMouseEvent* ev
|
||||
unsigned long timeSinceLast = presentTime - m_lastTime;
|
||||
if ( timeSinceLast == 0 ) timeSinceLast = 1; // one millisecond
|
||||
|
||||
int deltaX = eventWhenRotating->x() - m_lastPosX;
|
||||
int deltaY = eventWhenRotating->y() - m_lastPosY;
|
||||
int deltaX = eventWhenRotating->position().x() - m_lastPosX;
|
||||
int deltaY = eventWhenRotating->position().y() - m_lastPosY;
|
||||
|
||||
cvf::Vec2d mouseVelocity( deltaX, deltaY );
|
||||
mouseVelocity /= 1.0e-3 * timeSinceLast;
|
||||
@ -367,8 +367,8 @@ double caf::RotationSensitivityCalculator::calculateSensitivity( QMouseEvent* ev
|
||||
if ( mouseVelocityLengthCorr < slowLimit )
|
||||
sensitivity = mouseVelocityLengthCorr * mouseVelocityLengthCorr / ( slowLimit * slowLimit );
|
||||
|
||||
m_lastPosX = eventWhenRotating->x();
|
||||
m_lastPosY = eventWhenRotating->y();
|
||||
m_lastPosX = eventWhenRotating->position().x();
|
||||
m_lastPosY = eventWhenRotating->position().y();
|
||||
m_lastTime = eventWhenRotating->timestamp();
|
||||
m_lastMouseVelocityLenght = 0.8 * mouseVelocityLength + 0.2 * m_lastMouseVelocityLenght;
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ void MouseState::updateFromMouseEvent(QMouseEvent* event)
|
||||
if (numMouseButtonsInState(m_mouseButtonState) == 1)
|
||||
{
|
||||
m_cleanButtonPressButton = buttonPressed;
|
||||
m_cleanButtonPressPosX = event->x();
|
||||
m_cleanButtonPressPosY = event->y();
|
||||
m_cleanButtonPressPosX = event->position().x();
|
||||
m_cleanButtonPressPosY = event->pos().y();
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,8 +115,8 @@ void MouseState::updateFromMouseEvent(QMouseEvent* event)
|
||||
m_cleanButtonPressPosY != cvf::UNDEFINED_INT)
|
||||
{
|
||||
// We have a candidate, check if movement is within tolerance
|
||||
if (cvf::Math::abs(double((m_cleanButtonPressPosX - event->x()))) <= m_cleanButtonClickTolerance &&
|
||||
cvf::Math::abs(double((m_cleanButtonPressPosY - event->y()))) <= m_cleanButtonClickTolerance)
|
||||
if (cvf::Math::abs(double((m_cleanButtonPressPosX - event->position().x()))) <= m_cleanButtonClickTolerance &&
|
||||
cvf::Math::abs(double((m_cleanButtonPressPosY - event->pos().y()))) <= m_cleanButtonClickTolerance)
|
||||
{
|
||||
m_cleanButtonClickButton = buttonReleased;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user