From a3b99881089fc5b4afdce1f80276902493ea75f0 Mon Sep 17 00:00:00 2001 From: Adam Higerd Date: Tue, 10 Aug 2021 18:06:34 -0500 Subject: [PATCH] Don't make the top-left square of the logging grid checkable --- src/platform/qt/LogConfigModel.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/platform/qt/LogConfigModel.cpp b/src/platform/qt/LogConfigModel.cpp index aa9ab1e81..dd3d48b6a 100644 --- a/src/platform/qt/LogConfigModel.cpp +++ b/src/platform/qt/LogConfigModel.cpp @@ -27,6 +27,9 @@ QVariant LogConfigModel::data(const QModelIndex& index, int role) const { } int levels; if (index.row() == 0) { + if (index.column() == 0) { + return QVariant(); + } levels = m_levels; } else { levels = m_cache[index.row() - 1].levels; @@ -46,6 +49,9 @@ bool LogConfigModel::setData(const QModelIndex& index, const QVariant& value, in } int levels; if (index.row() == 0) { + if (index.column() == 0) { + return false; + } levels = m_levels; } else { levels = m_cache[index.row() - 1].levels; @@ -60,7 +66,7 @@ bool LogConfigModel::setData(const QModelIndex& index, const QVariant& value, in if (value.value() == Qt::Unchecked) { levels &= ~bit; } else { - levels |= bit; + levels |= bit; } } if (index.row() == 0) { @@ -132,10 +138,10 @@ int LogConfigModel::rowCount(const QModelIndex& parent) const { } Qt::ItemFlags LogConfigModel::flags(const QModelIndex& index) const { - if (!index.isValid()) { + if (!index.isValid() || (index.row() == 0 && index.column() == 0)) { return 0; } - return Qt::ItemIsUserCheckable | Qt::ItemIsEditable | Qt::ItemIsEnabled; + return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; } void LogConfigModel::reset() {