Engauge Digitizer  2
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_POLYNOMIAL_TERMS = 1;
12 
14 {
15 }
16 
17 FittingModel::~FittingModel()
18 {
19 }
20 
21 QVariant FittingModel::data(const QModelIndex &index, int role) const
22 {
23 // LOG4CPP_DEBUG_S ((*mainCat)) << "FittingModel::data"
24 // << " index=(row=" << index.row() << ",col=" << index.column() << ",role=" << role << ")="
25 // << " rows=" << rowCount()
26 // << " cols=" << columnCount();
27 
28  if (role == Qt::BackgroundRole &&
29  index.row() == rowCount() - 1 &&
30  index.column() == COLUMN_POLYNOMIAL_TERMS) {
31 
32  // Bottom right cell would be empty so we gray it out
33  return QVariant::fromValue (QColor (Qt::lightGray));
34  }
35 
36  // Standard behavior
37  return QStandardItemModel::data (index, role);
38 }
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Override for special processing.
FittingModel()
Single constructor.