@@ -210,7 +210,11 @@ void ViewerWidget::keyReleaseEvent(QKeyEvent *event)
210210void ViewerWidget::mouseMoveEvent (QMouseEvent *event)
211211{
212212 int pixelRatio = qCeil (qApp->devicePixelRatio ());
213+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
214+ getEventQueue ()->mouseMotion (static_cast <float >(event->position ().x () * pixelRatio), static_cast <float >(event->position ().y () * pixelRatio));
215+ #else
213216 getEventQueue ()->mouseMotion (static_cast <float >(event->x () * pixelRatio), static_cast <float >(event->y () * pixelRatio));
217+ #endif
214218}
215219
216220/* !
@@ -240,15 +244,23 @@ void ViewerWidget::mousePressEvent(QMouseEvent *event)
240244 mMouseButton = 3 ;
241245 if (event->modifiers () == Qt::ShiftModifier) {
242246 // qt counts pixels from upper left corner and osg from bottom left corner
247+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
248+ pickVisualizer (event->position ().x () * pixelRatio, (this ->height () - event->position ().y ()) * pixelRatio);
249+ #else
243250 pickVisualizer (event->x () * pixelRatio, (this ->height () - event->y ()) * pixelRatio);
251+ #endif
244252 showVisualizerPickContextMenu (event->pos ());
245253 return ;
246254 }
247255 break ;
248256 default :
249257 break ;
250258 }
259+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
260+ getEventQueue ()->mouseButtonPress (static_cast <float >(event->position ().x () * pixelRatio), static_cast <float >(event->position ().y () * pixelRatio), mMouseButton );
261+ #else
251262 getEventQueue ()->mouseButtonPress (static_cast <float >(event->x () * pixelRatio), static_cast <float >(event->y () * pixelRatio), mMouseButton );
263+ #endif
252264}
253265
254266/* !
@@ -499,7 +511,11 @@ void ViewerWidget::mouseReleaseEvent(QMouseEvent *event)
499511 break ;
500512 }
501513 int pixelRatio = qCeil (qApp->devicePixelRatio ());
514+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
515+ getEventQueue ()->mouseButtonRelease (static_cast <float >(event->position ().x () * pixelRatio), static_cast <float >(event->position ().y () * pixelRatio), mMouseButton );
516+ #else
502517 getEventQueue ()->mouseButtonRelease (static_cast <float >(event->x () * pixelRatio), static_cast <float >(event->y () * pixelRatio), mMouseButton );
518+ #endif
503519}
504520
505521/* !
0 commit comments