From 353529a3e2db7767aee327a03b34c30130b7eb5b Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:12:14 +0100 Subject: [PATCH] Mon GUI: Fixed Column labels in signal plotting widget (#1326) "Number" and "Rule" were mixed up, before --- .../signals_plotting/src/signal_tree_model.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/mon/mon_plugins/signals_plotting/src/signal_tree_model.cpp b/app/mon/mon_plugins/signals_plotting/src/signal_tree_model.cpp index 523ae596aa..2bcdf4b97a 100644 --- a/app/mon/mon_plugins/signals_plotting/src/signal_tree_model.cpp +++ b/app/mon/mon_plugins/signals_plotting/src/signal_tree_model.cpp @@ -74,10 +74,16 @@ Qt::ItemFlags SignalTreeModel::flags(const QModelIndex& index) const QVariant SignalTreeModel::data(const QModelIndex& index, int role) const { QAbstractTreeItem* tree_item = item(index); - if (tree_item) - return (index.column() >= 0 ? tree_item->data(index.column(), (Qt::ItemDataRole)role) : QVariant()); - else - return QVariant(); + if (tree_item != nullptr) + { + int const item_column = mapColumnToItem(index.column(), tree_item->type()); + if (item_column >= 0) + { + return tree_item->data(item_column, (Qt::ItemDataRole)role); + } + } + + return QVariant(); } void SignalTreeModel::setCheckedState(SignalTreeItem* item, int index_column)