@@ -90,7 +90,9 @@ MainWindow::MainWindow(bool load_settings, QWidget* parent)
9090 charts_widget_(new ChartsWidget(this )),
9191 help_widget_(new HelpWidget(this )),
9292 find_dialog_(new FindObjectDialog(this )),
93- goto_dialog_(new GotoLocationDialog(this , viewers_))
93+ goto_dialog_(new GotoLocationDialog(this , viewers_)),
94+ selection_timer_(std::make_unique<QTimer>()),
95+ highlight_timer_(std::make_unique<QTimer>())
9496{
9597 QFont font (" Monospace" );
9698 font.setStyleHint (QFont::Monospace);
@@ -379,6 +381,13 @@ MainWindow::MainWindow(bool load_settings, QWidget* parent)
379381 &MainWindow::displayUnitsChanged,
380382 goto_dialog_,
381383 &GotoLocationDialog::updateUnits);
384+ connect (selection_timer_.get (), &QTimer::timeout, [this ]() {
385+ emit selectionChanged ();
386+ });
387+ connect (highlight_timer_.get (),
388+ &QTimer::timeout,
389+ this ,
390+ &MainWindow::highlightChanged);
382391
383392 createActions ();
384393 createToolbars ();
@@ -428,6 +437,12 @@ MainWindow::MainWindow(bool load_settings, QWidget* parent)
428437 = [this ](const std::string& value, bool * ok) -> int {
429438 return convertStringToDBU (value, ok);
430439 };
440+
441+ selection_timer_->setSingleShot (true );
442+ highlight_timer_->setSingleShot (true );
443+
444+ selection_timer_->setInterval (100 /* ms */ );
445+ highlight_timer_->setInterval (100 /* ms */ );
431446}
432447
433448void MainWindow::showEvent (QShowEvent* event)
@@ -1134,7 +1149,7 @@ void MainWindow::addSelected(const SelectionSet& selections, bool find_in_cts)
11341149 }
11351150 status (std::string (" Added " )
11361151 + std::to_string (selected_.size () - prev_selected_size));
1137- emit selectionChanged ();
1152+ selection_timer_-> start ();
11381153
11391154 if (find_in_cts) {
11401155 emit findInCts (selections);
@@ -1178,7 +1193,7 @@ void MainWindow::addHighlighted(const SelectionSet& highlights,
11781193 group.insert (highlight);
11791194 }
11801195 }
1181- emit highlightChanged ();
1196+ highlight_timer_-> start ();
11821197}
11831198
11841199std::string MainWindow::addLabel (int x,
0 commit comments