@@ -39,13 +39,13 @@ This file is part of Fast Track.
3939 * @brief Constructs the interactive object derived from a QMainWindow object.
4040 */
4141Interactive::Interactive (QWidget *parent) : QMainWindow(parent),
42- ui(new Ui::Interactive) {
42+ ui(new Ui::Interactive),
43+ videoStatus(false ) {
4344 ui->setupUi (this );
4445 ui->menuBar ->setNativeMenuBar (false );
4546
4647 // Loads settings
4748 QSettings settingsFile (QStringLiteral (" FastTrack" ), QStringLiteral (" FastTrackOrg" ));
48- videoStatus = false ;
4949
5050 // MetaType
5151 qRegisterMetaType<QMap<QString, double >>(" QMap<QString, double>" );
@@ -462,7 +462,7 @@ Interactive::Interactive(QWidget *parent) : QMainWindow(parent),
462462
463463 // Set the image preview limits
464464 connect (ui->startImage , static_cast <void (QSpinBox::*)(int )>(&QSpinBox::valueChanged), this , [this ](int startImage) {
465- ui->stopImage ->setRange (0 , video->getImageCount () - startImage);
465+ ui->stopImage ->setRange (0 , static_cast < int >( video->getImageCount () ) - startImage);
466466 });
467467
468468 // Events filter to zoom in/out in the display
@@ -539,12 +539,12 @@ void Interactive::openFolder() {
539539 memoryDir = dir;
540540 video->open (dir.toStdString ());
541541 ui->slider ->setMinimum (0 );
542- ui->slider ->setMaximum (video->getImageCount () - 1 );
542+ ui->slider ->setMaximum (static_cast < int >( video->getImageCount () ) - 1 );
543543 ui->previewButton ->setDisabled (true );
544544 ui->trackButton ->setDisabled (true );
545- ui->nBack ->setMaximum (video->getImageCount ());
546- ui->nBack ->setValue (video->getImageCount ());
547- ui->startImage ->setRange (0 , video->getImageCount () - 1 );
545+ ui->nBack ->setMaximum (static_cast < int >( video->getImageCount () ));
546+ ui->nBack ->setValue (static_cast < int >( video->getImageCount () ));
547+ ui->startImage ->setRange (0 , static_cast < int >( video->getImageCount () ) - 1 );
548548 ui->startImage ->setValue (0 );
549549
550550 Mat frame;
@@ -938,7 +938,7 @@ void Interactive::previewTracking() {
938938 */
939939void Interactive::track () {
940940 if (videoStatus) {
941- ui->progressBar ->setRange (0 , video->getImageCount () - 1 );
941+ ui->progressBar ->setRange (0 , static_cast < int >( video->getImageCount () ) - 1 );
942942 ui->progressBar ->setValue (0 );
943943 ui->previewButton ->setDisabled (true );
944944 ui->trackButton ->setDisabled (true );
@@ -1003,25 +1003,25 @@ bool Interactive::eventFilter(QObject *target, QEvent *event) {
10031003 if (target == ui->display ) {
10041004 // Set the first point for the ROI at user click
10051005 if (event->type () == QEvent::MouseButtonPress) {
1006- QMouseEvent *mouseEvent = static_cast <QMouseEvent *>(event);
1006+ QMouseEvent *mouseEvent = dynamic_cast <QMouseEvent *>(event);
10071007 if (mouseEvent->buttons () == Qt::LeftButton) {
10081008 clicks.first = mouseEvent->pos ();
10091009 // The QPixmap is V/Hcentered in the Qlabel widget
10101010 // Gets the click coordinate in the frame of reference of the centered display
1011- clicks.first .setX (static_cast <unsigned int >(clicks.first .x () - 0.5 * (ui->display ->width () - resizedFrame.width ())));
1012- clicks.first .setY (static_cast <unsigned int >(clicks.first .y () - 0.5 * (ui->display ->height () - resizedFrame.height ())));
1011+ clicks.first .setX (static_cast <int >(clicks.first .x () - 0.5 * (ui->display ->width () - resizedFrame.width ())));
1012+ clicks.first .setY (static_cast <int >(clicks.first .y () - 0.5 * (ui->display ->height () - resizedFrame.height ())));
10131013 }
10141014 }
10151015
10161016 // Sets the second point and draw the roi
10171017 if (event->type () == QEvent::MouseMove) {
1018- QMouseEvent *moveEvent = static_cast <QMouseEvent *>(event);
1018+ QMouseEvent *moveEvent = dynamic_cast <QMouseEvent *>(event);
10191019 if (moveEvent->buttons () == Qt::LeftButton) {
10201020 clicks.second = moveEvent->pos ();
10211021 // The QPixmap is V/Hcentered in the Qlabel widget
10221022 // Gets the click coordinate in the frame of reference of the centered display
1023- clicks.second .setX (static_cast <unsigned int >(clicks.second .x () - 0.5 * (ui->display ->width () - resizedFrame.width ())));
1024- clicks.second .setY (static_cast <unsigned int >(clicks.second .y () - 0.5 * (ui->display ->height () - resizedFrame.height ())));
1023+ clicks.second .setX (static_cast <int >(clicks.second .x () - 0.5 * (ui->display ->width () - resizedFrame.width ())));
1024+ clicks.second .setY (static_cast <int >(clicks.second .y () - 0.5 * (ui->display ->height () - resizedFrame.height ())));
10251025
10261026 // Draws the ROI with
10271027 QPixmap tmpImage = resizedPix;
@@ -1065,21 +1065,21 @@ bool Interactive::eventFilter(QObject *target, QEvent *event) {
10651065 if (target == ui->scrollArea ->viewport ()) {
10661066 // Moves in the image by middle click
10671067 if (event->type () == QEvent::MouseMove) {
1068- QMouseEvent *moveEvent = static_cast <QMouseEvent *>(event);
1068+ QMouseEvent *moveEvent = dynamic_cast <QMouseEvent *>(event);
10691069 if (moveEvent->buttons () == Qt::MiddleButton) {
1070- ui->scrollArea ->horizontalScrollBar ()->setValue (static_cast <unsigned int >(ui->scrollArea ->horizontalScrollBar ()->value () + (panReferenceClick.x () - moveEvent->localPos ().x ())));
1071- ui->scrollArea ->verticalScrollBar ()->setValue (static_cast <unsigned int >(ui->scrollArea ->verticalScrollBar ()->value () + (panReferenceClick.y () - moveEvent->localPos ().y ())));
1070+ ui->scrollArea ->horizontalScrollBar ()->setValue (static_cast <int >(ui->scrollArea ->horizontalScrollBar ()->value () + (panReferenceClick.x () - moveEvent->localPos ().x ())));
1071+ ui->scrollArea ->verticalScrollBar ()->setValue (static_cast <int >(ui->scrollArea ->verticalScrollBar ()->value () + (panReferenceClick.y () - moveEvent->localPos ().y ())));
10721072 panReferenceClick = moveEvent->localPos ();
10731073 }
10741074 }
10751075 if (event->type () == QEvent::Wheel) {
1076- QWheelEvent *wheelEvent = static_cast <QWheelEvent *>(event);
1076+ QWheelEvent *wheelEvent = dynamic_cast <QWheelEvent *>(event);
10771077 zoomReferencePosition = wheelEvent->position ();
10781078 }
10791079
10801080 // Zoom/unzoom the display by wheel
10811081 if (event->type () == QEvent::Wheel) {
1082- QWheelEvent *wheelEvent = static_cast <QWheelEvent *>(event);
1082+ QWheelEvent *wheelEvent = dynamic_cast <QWheelEvent *>(event);
10831083 if (wheelEvent->angleDelta ().y () > 0 ) {
10841084 zoomIn ();
10851085 }
@@ -1089,7 +1089,7 @@ bool Interactive::eventFilter(QObject *target, QEvent *event) {
10891089 return true ;
10901090 }
10911091 if (event->type () == QEvent::MouseButtonPress) {
1092- QMouseEvent *mouseEvent = static_cast <QMouseEvent *>(event);
1092+ QMouseEvent *mouseEvent = dynamic_cast <QMouseEvent *>(event);
10931093 if (mouseEvent->buttons () == Qt::MiddleButton) {
10941094 qApp->setOverrideCursor (Qt::ClosedHandCursor);
10951095 panReferenceClick = mouseEvent->localPos ();
0 commit comments