]> git.sesse.net Git - pkanalytics/commitdiff
Fix a corner case around clicking event rows.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 2 May 2023 17:37:00 +0000 (19:37 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 2 May 2023 17:37:00 +0000 (19:37 +0200)
main.cpp

index ab5cf5c85dac4c9fa50edf0172f996e15c511515..2caa63fbf3fdb6190dc1de55d3a47b2ac76bb868 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -44,7 +44,15 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players) : events(even
        ui->event_view->setModel(events);
        connect(ui->event_view->selectionModel(), &QItemSelectionModel::currentRowChanged,
                [this, events](const QModelIndex &current, const QModelIndex &previous) {
-                       video->setPosition(events->get_time(current.row()));
+                       uint64_t t = events->get_time(current.row());
+                       if (t != video->position()) {
+                               video->setPosition(events->get_time(current.row()));
+                       } else {
+                               // Selection could have changed, so we still need to update.
+                               // (Just calling setPosition() would not give us the signal
+                               // in this case.)
+                               update_ui_from_time(t);
+                       }
                });
 
        ui->player_view->setModel(players);