From 20f335c0bc66f7703f6a271a065307e39acbd924 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 12 Jul 2016 03:14:40 +0200 Subject: [PATCH] refs #707, adjusted list model base * allow property for line numbers * compare for ATC stations --- src/blackgui/models/listmodelbase.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/blackgui/models/listmodelbase.cpp b/src/blackgui/models/listmodelbase.cpp index cdcdf7e89..790226bf1 100644 --- a/src/blackgui/models/listmodelbase.cpp +++ b/src/blackgui/models/listmodelbase.cpp @@ -331,9 +331,15 @@ namespace BlackGui // Upfront checking avoids unnecessary data fetching if (!formatter || !formatter->supportsRole(role)) { return CListModelBaseNonTemplate::data(index, role); } + // index, updront checking + const BlackMisc::CPropertyIndex propertyIndex = this->columnToPropertyIndex(col); + if (static_cast(CPropertyIndex::GlobalIndexLineNumber) == propertyIndex.frontCasted()) + { + return QVariant::fromValue(row + 1); + } + // Formatted data const ObjectType obj = this->containerOrFilteredContainer()[row]; - BlackMisc::CPropertyIndex propertyIndex = this->columnToPropertyIndex(col); return formatter->data(role, obj.propertyByIndex(propertyIndex)).getQVariant(); } @@ -357,8 +363,8 @@ namespace BlackGui if (obj != currentObject) { - QModelIndex topLeft = index.sibling(index.row(), 0); - QModelIndex bottomRight = index.sibling(index.row(), this->columnCount() - 1); + const QModelIndex topLeft = index.sibling(index.row(), 0); + const QModelIndex bottomRight = index.sibling(index.row(), this->columnCount() - 1); this->m_container[index.row()] = obj; const CVariant co = CVariant::from(obj); emit objectChanged(co, propertyIndex); @@ -781,7 +787,7 @@ namespace BlackGui template class CListModelBase; template class CListModelBase; template class CListModelBase; - template class CListModelBase; + template class CListModelBase; template class CListModelBase; template class CListModelBase; template class CListModelBase; @@ -792,11 +798,9 @@ namespace BlackGui template class CListModelBase; template class CListModelBase; template class CListModelBase; - template class CListModelBase; template class CListModelBase; template class CListModelBase; - } // namespace } // namespace