From 952ca4bf99b0abc1c821536aa4566c2326624ff3 Mon Sep 17 00:00:00 2001 From: Bionus Date: Sat, 20 Apr 2024 14:32:00 +0200 Subject: [PATCH] fix: keep sorting when editing monitors (fix #3134) --- src/gui/src/tabs/monitors-tab.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/src/tabs/monitors-tab.cpp b/src/gui/src/tabs/monitors-tab.cpp index ba6904be5..7c7d1ab4d 100644 --- a/src/gui/src/tabs/monitors-tab.cpp +++ b/src/gui/src/tabs/monitors-tab.cpp @@ -30,6 +30,13 @@ MonitorsTab::MonitorsTab(Profile *profile, MonitorManager *monitorManager, Monit ui->tableMonitors->setModel(m_monitorTableModel); connect(m_monitoringCenter, &MonitoringCenter::statusChanged, monitorTableModel, &MonitorTableModel::setStatus); + // Re-trigger sort on insert (FIXME: we shouldn't need to do this) + connect(m_monitorTableModel, &MonitorTableModel::rowsInserted, [=]() { + QTimer::singleShot(1, [=]() { + m_monitorTableModel->invalidate(); + }); + }); + auto *actionRemoveSelected = new QShortcut(QKeySequence::Delete, ui->tableMonitors); actionRemoveSelected->setContext(Qt::WidgetWithChildrenShortcut); connect(actionRemoveSelected, &QShortcut::activated, this, &MonitorsTab::removeSelected);