Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
FittingModel.cpp
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "FittingModel.h"
8 #include "Logger.h"
9 #include <QTableView>
10 
11 const int COLUMN_COEFFICIENTS = 0;
12 const int COLUMN_POLYNOMIAL_TERMS = 1;
13 
15 {
16 }
17 
18 FittingModel::~FittingModel()
19 {
20 }
21 
22 QVariant FittingModel::data(const QModelIndex &index, int role) const
23 {
24 // LOG4CPP_DEBUG_S ((*mainCat)) << "FittingModel::data"
25 // << " index=(row=" << index.row() << ",col=" << index.column() << ",role=" << role << ")="
26 // << " rows=" << rowCount()
27 // << " cols=" << columnCount();
28 
29  if (role == Qt::BackgroundRole &&
30  index.row() == rowCount() - 1 &&
31  index.column() == COLUMN_POLYNOMIAL_TERMS) {
32 
33  // Bottom right cell would be empty so we gray it out
34  return QVariant::fromValue (QColor (Qt::lightGray));
35  }
36 
37  // Standard behavior
38  return QStandardItemModel::data (index, role);
39 }
FittingModel()
Single constructor.
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Override for special processing.