summaryrefslogtreecommitdiffhomepage
path: root/tracker-aruco/pt_video_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-aruco/pt_video_widget.cpp')
-rw-r--r--tracker-aruco/pt_video_widget.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tracker-aruco/pt_video_widget.cpp b/tracker-aruco/pt_video_widget.cpp
index 38d7a5e8..749eca0b 100644
--- a/tracker-aruco/pt_video_widget.cpp
+++ b/tracker-aruco/pt_video_widget.cpp
@@ -13,7 +13,8 @@
PTVideoWidget::PTVideoWidget(QWidget* parent) :
QWidget(parent),
- freshp(false)
+ freshp(false),
+ visible(true)
{
connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint()));
timer.start(50);
@@ -44,9 +45,16 @@ void PTVideoWidget::paintEvent(QPaintEvent* e)
void PTVideoWidget::update_and_repaint()
{
- if (is_window_visible(this))
+ QMutexLocker l(&mtx);
+
+ if (window_check_timer.elapsed_ms() > 2000)
+ {
+ visible = is_window_visible(this);
+ window_check_timer.start();
+ }
+
+ if (visible)
{
- QMutexLocker foo(&mtx);
if (_frame.empty() || !freshp)
return;
cv::cvtColor(_frame, _frame2, cv::COLOR_RGB2BGR);