Hightlight lines when touched.

This commit is contained in:
2025-12-19 17:37:24 +01:00
parent 3e5f616461
commit 552fcdf8f8
11 changed files with 140 additions and 40 deletions

View File

@@ -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();
}