Hightlight lines when touched.
This commit is contained in:
@@ -50,22 +50,30 @@ void BCValueModel::setValueList(const BCValueList& valueList)
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
BCValueList& BCValueModel::getValueList()
|
||||
{
|
||||
return _valueList;
|
||||
}
|
||||
|
||||
int BCValueModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid()) return 0;
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return _valueList.size();
|
||||
}
|
||||
|
||||
QVariant BCValueModel::data(const QModelIndex &index, int role) const
|
||||
QVariant BCValueModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() >= _valueList.size())
|
||||
int row = index.row();
|
||||
if (!index.isValid() || row >= _valueList.size())
|
||||
return QVariant();
|
||||
|
||||
const BCValue &item = _valueList.at(index.row());
|
||||
BCValue& value = const_cast<BCValue&>(_valueList.at( row ));
|
||||
value.rowInModel = row;
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
return QVariant::fromValue(value);
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
return QVariant::fromValue(item);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user