Reworked value handling.

This commit is contained in:
Christoph Holzheuer
2026-01-19 16:44:52 +01:00
parent 4309d2231e
commit 8639529bbe
12 changed files with 95 additions and 80 deletions

View File

@@ -62,9 +62,16 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
const BCValue& bcValue = *(_valueList[ index.row()].get());
qDebug() << " --- Create Editor: " << bcValue.getLabel() << " ratio: " << bcValue.calcMinMaxRatio() << " raw: " << bcValue.getRawValue() << " scaled: " << bcValue.getScaledValue();
int value,min,max;
bool hasData = bcValue.valuesForSlider( value, min, max );
if( !hasData )
return nullptr;
auto* valueEditor = new BCValueEditor(bcValue.getScaledValue(), parent);
qDebug() << " --- Create Editor: " << bcValue.label() << " value: " << value << " min: " << min << " max: " << max << " ratio:" << bcValue.calcMinMaxRatio()*100.0 << '%';
auto* valueEditor = new BCValueEditor(parent);
valueEditor->setValue( value );
valueEditor->setRange( min, max );
// Signal für sofortige Updates
connect(valueEditor, &BCValueEditor::valueChanged, this, [this, valueEditor]()
@@ -122,8 +129,15 @@ void BCValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem& optio
if( row>-1 && row <= _valueList.size() )
{
const BCValue& bcValue = *(_valueList[ index.row()].get());
if( !bcValue.isReadOnly())
paintSliderIndicator(painter,option,bcValue);
if( !bcValue.isReadOnly() )
{
if( bcValue.valueType() == BCValue::ValueType::Bool )
paintButtonIndicator(painter,option,bcValue);
else
paintSliderIndicator(painter,option,bcValue);
}
}
if(_rowOpacities.contains(row))
@@ -175,6 +189,11 @@ void BCValueDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionVi
}
void BCValueDelegate::paintButtonIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
{
}
/**
* @brief Zeichnet eine passiven Slider, um den möglichen Wertebereich des übergebenen BCValue anzuzeigen.
*/