diff data/model/ModelDataTableModel.cpp @ 424:eafef13bb0b3

* Add more data-editor support to various models
author Chris Cannam
date Thu, 12 Jun 2008 14:33:45 +0000
parents 4caa28a0a8a2
children f5e8f12d2e58
line wrap: on
line diff
--- a/data/model/ModelDataTableModel.cpp	Thu Jun 12 10:47:11 2008 +0000
+++ b/data/model/ModelDataTableModel.cpp	Thu Jun 12 14:33:45 2008 +0000
@@ -41,6 +41,7 @@
 QVariant
 ModelDataTableModel::data(const QModelIndex &index, int role) const
 {
+    if (role != Qt::EditRole && role != Qt::DisplayRole) return QVariant();
     if (!index.isValid()) return QVariant();
     return m_model->getData(getUnsorted(index.row()), index.column(), role);
 }
@@ -236,8 +237,7 @@
     int rows = m_model->getRowCount();
 
     for (int i = 0; i < rows; ++i) {
-        QVariant value =
-            m_model->getData(i, m_sortColumn, TabularModel::SortRole);
+        QVariant value = m_model->getData(i, m_sortColumn, TabularModel::SortRole);
         rowMap.insert(MapType::value_type(value.toDouble(), i));
     }