From 35978072c44f5ec84417da43904e7dad879fc5a4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 17 Apr 2017 16:38:22 +0200 Subject: few widgets: use repaint() for no event loop overhead The Qt event loop overhead formed a decent amount of total CPU usage. `repaint()' is a direct call. --- gui/main-window.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/main-window.cpp b/gui/main-window.cpp index fb036721..1fdfcb53 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -86,7 +86,7 @@ MainWindow::MainWindow() : // timers connect(&config_list_timer, &QTimer::timeout, this, [this]() { refresh_config_list(); }); - connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose())); + connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose()), Qt::DirectConnection); connect(&det_timer, SIGNAL(timeout()), this, SLOT(maybe_start_profile_from_executable())); // ctrl+q exits @@ -515,8 +515,8 @@ void MainWindow::display_pose(const double *mapped, const double *raw) ui.pose_display->rotate_async(mapped[Yaw], mapped[Pitch], -mapped[Roll], mapped[TX], mapped[TY], mapped[TZ]); - if (mapping_widget) - mapping_widget->update(); + if (mapping_widget && mapping_widget->isVisible()) + mapping_widget->repaint(); QLCDNumber* raw_[] = { ui.raw_x, ui.raw_y, ui.raw_z, -- cgit v1.2.3