Skip to content

Commit

Permalink
apps/radar - for Qt apps, added #if to allow for deprecated pos() met…
Browse files Browse the repository at this point in the history
…hod in QMouseEvent
  • Loading branch information
mike-dixon committed Dec 30, 2023
1 parent 3276ff0 commit c84122f
Show file tree
Hide file tree
Showing 17 changed files with 250 additions and 166 deletions.
36 changes: 26 additions & 10 deletions codebase/apps/radar/src/HawkEdit/BscanWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,17 @@ QPixmap* BscanWidget::getPixmap()
void BscanWidget::mousePressEvent(QMouseEvent *e)
{

_rubberBand->setGeometry(QRect(e->pos(), QSize()));
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_rubberBand->setGeometry(pos.x(), pos.y(), 0, 0);
_rubberBand->show();

_mousePressX = e->x();
_mousePressY = e->y();
_mousePressX = pos.x();
_mousePressY = pos.y();

_worldPressX = _zoomWorld.getXWorld(_mousePressX);
_worldPressY = _zoomWorld.getYWorld(_mousePressY);
Expand All @@ -553,8 +559,14 @@ void BscanWidget::mouseMoveEvent(QMouseEvent * e)
{
// Zooming with the mouse

int x = e->x();
int y = e->y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

int x = pos.x();
int y = pos.y();
int deltaX = x - _mousePressX;
int deltaY = y - _mousePressY;

Expand All @@ -580,10 +592,14 @@ void BscanWidget::mouseReleaseEvent(QMouseEvent *e)
// If the mouse hasn't moved much, assume we are clicking rather than
// zooming

QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

// get click location in world coords

Expand Down
38 changes: 30 additions & 8 deletions codebase/apps/radar/src/HawkEdit/PolarWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,12 @@ void PolarWidget::mapPixelToWorld(int x, int y, double *worldX, double *worldY)
void PolarWidget::mousePressEvent(QMouseEvent *e)
{

#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mousePressX = pos.x();
_mousePressY = pos.y();

Expand All @@ -485,8 +490,8 @@ void PolarWidget::mousePressEvent(QMouseEvent *e)
_rubberBand->hide();
_boundaryTrackMouseMove = true;
} else {
_rubberBand->setGeometry(QRect(e->pos(), QSize()));
_rubberBand->show();
_rubberBand->setGeometry(pos.x(), pos.y(), 0, 0);
_rubberBand->show();
}
}

Expand All @@ -500,7 +505,13 @@ void PolarWidget::mouseMoveEvent(QMouseEvent * e)
double worldX;
double worldY;

mapPixelToWorld(e->pos().x(), e->pos().y(), &worldX, &worldY);
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

mapPixelToWorld(pos.x(), pos.y(), &worldX, &worldY);

if (_boundaryTrackMouseMove) {
_manager->moveBoundaryPoint(_worldPressX, _worldPressY,
Expand All @@ -511,7 +522,6 @@ void PolarWidget::mouseMoveEvent(QMouseEvent * e)

// Zooming with the mouse

QPointF pos(e->pos());
int x = pos.x();
int y = pos.y();
int deltaX = x - _mousePressX;
Expand Down Expand Up @@ -553,8 +563,14 @@ void PolarWidget::mouseReleaseEvent(QMouseEvent *e)
QRect rgeom = _rubberBand->geometry();
QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

mapPixelToWorld(_mouseReleaseX, _mouseReleaseY, &_worldReleaseX, &_worldReleaseY);
// get click location in world coords
Expand Down Expand Up @@ -622,8 +638,14 @@ void PolarWidget::mouseDoubleClickEvent(QMouseEvent *e)

QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

mapPixelToWorld(_mouseReleaseX, _mouseReleaseY, &_worldReleaseX, &_worldReleaseY);
cerr << "translate to (mouse)" << _mouseReleaseX << ", " << _mouseReleaseY << endl;
Expand Down
12 changes: 8 additions & 4 deletions codebase/apps/radar/src/HawkEdit/PpiWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -964,10 +964,14 @@ void PpiWidget::mouseReleaseEvent(QMouseEvent *e)
// If the mouse hasn't moved much, assume we are clicking rather than
// zooming

QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

// get click location in world coords

Expand Down
12 changes: 8 additions & 4 deletions codebase/apps/radar/src/HawkEdit/RhiWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,14 @@ void RhiWidget::mouseReleaseEvent(QMouseEvent *e)
// If the mouse hasn't moved much, assume we are clicking rather than
// zooming

QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

// get click location in world coords

Expand Down
25 changes: 16 additions & 9 deletions codebase/apps/radar/src/HawkEdit/TimeScaleWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,14 @@ void TimeScaleWidget::setBackgroundColor(const QColor &color)
void TimeScaleWidget::mousePressEvent(QMouseEvent *e)
{

cerr << "4444444444444444444444444" << endl;

_mousePressX = e->x();
_mousePressY = e->y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mousePressX = pos.x();
_mousePressY = pos.y();

_worldPressX = _world.getXWorld(_mousePressX);
_worldPressY = _world.getYWorld(_mousePressY);
Expand All @@ -213,13 +217,16 @@ void TimeScaleWidget::mousePressEvent(QMouseEvent *e)
void TimeScaleWidget::mouseReleaseEvent(QMouseEvent *e)
{

cerr << "5555555555555555555555555" << endl;

_pointClicked = false;

QPointF clickPos(e->pos());
_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

// get click location in world coords

Expand Down
36 changes: 21 additions & 15 deletions codebase/apps/radar/src/HawkEye/BscanWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -545,16 +545,17 @@ QPixmap* BscanWidget::getPixmap()
void BscanWidget::mousePressEvent(QMouseEvent *e)
{

_rubberBand->setGeometry(QRect(e->pos(), QSize()));
_rubberBand->show();

#if QT_VERSION >= 0x060000
_mousePressX = e->position().x();
_mousePressY = e->position().y();
QPointF pos(e->position());
#else
_mousePressX = e->x();
_mousePressY = e->y();
QPointF pos(e->pos());
#endif

_rubberBand->setGeometry(pos.x(), pos.y(), 0, 0);
_rubberBand->show();

_mousePressX = pos.x();
_mousePressY = pos.y();

_worldPressX = _zoomWorld.getXWorld(_mousePressX);
_worldPressY = _zoomWorld.getYWorld(_mousePressY);
Expand All @@ -571,13 +572,14 @@ void BscanWidget::mouseMoveEvent(QMouseEvent * e)
// Zooming with the mouse

#if QT_VERSION >= 0x060000
int x = e->position().x();
int y = e->position().y();
QPointF pos(e->position());
#else
int x = e->x();
int y = e->y();
QPointF pos(e->pos());
#endif

int x = pos.x();
int y = pos.y();

int deltaX = x - _mousePressX;
int deltaY = y - _mousePressY;

Expand All @@ -603,10 +605,14 @@ void BscanWidget::mouseReleaseEvent(QMouseEvent *e)
// If the mouse hasn't moved much, assume we are clicking rather than
// zooming

QPointF clickPos(e->pos());

_mouseReleaseX = clickPos.x();
_mouseReleaseY = clickPos.y();
#if QT_VERSION >= 0x060000
QPointF pos(e->position());
#else
QPointF pos(e->pos());
#endif

_mouseReleaseX = pos.x();
_mouseReleaseY = pos.y();

// get click location in world coords

Expand Down
Loading

0 comments on commit c84122f

Please sign in to comment.