Reworked value reading.

This commit is contained in:
2025-12-24 12:11:59 +01:00
parent 4eb3b494fe
commit e948c9103c
16 changed files with 163 additions and 263 deletions

View File

@@ -35,7 +35,7 @@
BCDataModel::BCDataModel(QObject *parent) : QAbstractListModel(parent) {}
void BCDataModel::addValue(const BCDataItem& val)
void BCDataModel::addValue(const BCDataValue& val)
{
int row = _valueList.size();
beginInsertRows(QModelIndex(), row, row);
@@ -68,11 +68,11 @@ QVariant BCDataModel::data(const QModelIndex& index, int role) const
if (!index.isValid() || row >= _valueList.size())
return QVariant();
BCDataItem& entry = const_cast<BCDataItem&>(_valueList.at( row ));
BCDataValue& entry = const_cast<BCDataValue&>(_valueList.at( row ));
entry.rowInModel = row;
if (role == Qt::DisplayRole || role == Qt::EditRole)
return entry.value;
return entry.visibleValue;
return QVariant();
}
@@ -91,13 +91,13 @@ bool BCDataModel::setData(const QModelIndex& index, const QVariant& value, int r
{
if (index.isValid() && role == Qt::EditRole)
{
BCDataItem item = _valueList[index.row()];
BCDataValue item = _valueList[index.row()];
// Wir erwarten hier nur den Value-Teil (vom Slider/Editor)
// Checken ob Int oder Double
if (value.canConvert<double>())
{
item.value = value;
item.visibleValue = value.toString();
}
_valueList[index.row()] = item;