Reworked value handling.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user