Added getter & setter for BCValue
This commit is contained in:
@@ -90,7 +90,7 @@ void BCValueModel::updateValue(int row, BCValue::Flags newState, uint32_t rawVal
|
||||
|
||||
// Obacht hier!
|
||||
//value.valueFlags = state;
|
||||
value.rawValue = rawValue;
|
||||
value.setRawValue( rawValue );
|
||||
|
||||
QModelIndex idx = index(row,1);
|
||||
|
||||
@@ -148,12 +148,12 @@ QVariant BCValueModel::data(const QModelIndex& index, int role) const
|
||||
const BCValue& value = *(_valueList.at( row ).get());
|
||||
|
||||
if( col == 0 )
|
||||
return value.label;
|
||||
return value.getLabel();
|
||||
|
||||
if( col == 1)
|
||||
{
|
||||
if( role == Qt::DisplayRole )
|
||||
return QString("%1 %2").arg( value.formatValue(), value.unitLabel);
|
||||
return QString("%1 %2").arg( value.formatValue(), value.getUnitLabel());
|
||||
|
||||
return value.formatValue();
|
||||
}
|
||||
@@ -185,6 +185,8 @@ bool BCValueModel::setData(const QModelIndex& index, const QVariant& variant, in
|
||||
{
|
||||
BCValuePtr value = _valueList[index.row()];
|
||||
|
||||
qDebug() << "--- YES! " << variant.toInt();
|
||||
|
||||
// Wir erwarten hier nur den Value-Teil (vom Slider/Editor)
|
||||
// Checken ob Int oder Double
|
||||
if (variant.canConvert<int>())
|
||||
@@ -195,7 +197,8 @@ bool BCValueModel::setData(const QModelIndex& index, const QVariant& variant, in
|
||||
qDebug() << "--- YES! " << variant.toInt();
|
||||
//emit makeSimonHappy();
|
||||
}
|
||||
value->rawValue = variant.toInt();
|
||||
// QUARK!
|
||||
value->setRawValue( variant.toInt() );
|
||||
}
|
||||
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
|
||||
Reference in New Issue
Block a user