Skip to content

Commit

Permalink
Use Qt::PreciseTimer for maximum precision
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov committed Sep 30, 2024
1 parent 9285e44 commit 217ee17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Timeline::Timeline(QObject *parent)
}

connect(&mTimer, &QTimer::timeout, this, &Timeline::onTimer);
mTimer.setTimerType(Qt::TimerType::PreciseTimer);
mTimer.setInterval(defaultRealTimeInterval);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ void TwoDModelEngineApi::enableBackgroundSceneDebugging()
// then NXT and TRIK 2D fake scenes will be shown.
QGraphicsView * const fakeScene = new QGraphicsView;
fakeScene->setScene(mFakeScene.data());
QTimer * const timer = new QTimer;
QTimer * const timer = new QTimer(fakeScene);
QObject::connect(timer, &QTimer::timeout, &*mFakeScene, [this](){mFakeScene->update();});
timer->setTimerType(Qt::TimerType::PreciseTimer);
timer->setInterval(300);
timer->setSingleShot(false);
fakeScene->setMinimumWidth(700);
Expand Down
1 change: 1 addition & 0 deletions plugins/robots/utils/src/realTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using namespace utils;

RealTimer::RealTimer()
{
mTimer.setTimerType(Qt::TimerType::PreciseTimer);
setSingleShot(true);
connect(&mTimer, &QTimer::timeout, this, &RealTimer::timeout);
}
Expand Down

0 comments on commit 217ee17

Please sign in to comment.