Fixed value display bug.
This commit is contained in:
@@ -62,16 +62,15 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
|
||||
|
||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||
|
||||
int value,min,max;
|
||||
bool hasData = bcValue.valuesForSlider( value, min, max );
|
||||
BCValueEditorParams params;
|
||||
bool hasData = bcValue.valuesForSlider( params.value, params.min, params.max );
|
||||
if( !hasData )
|
||||
return nullptr;
|
||||
|
||||
qDebug() << " --- Create Editor: " << bcValue.label() << " value: " << value << " min: " << min << " max: " << max << " ratio:" << bcValue.calcMinMaxRatio()*100.0 << '%';
|
||||
qDebug() << " --- Create Editor: " << bcValue.label() << " value: " << params.value << " min: " << params.min << " max: " << params.max << " ratio:" << bcValue.calcMinMaxRatio()*100.0 << '%';
|
||||
|
||||
auto* valueEditor = new BCValueEditor(parent);
|
||||
valueEditor->setValue( value );
|
||||
valueEditor->setRange( min, max );
|
||||
valueEditor->setValueAndRange( params );
|
||||
|
||||
// Signal für sofortige Updates
|
||||
connect(valueEditor, &BCValueEditor::valueChanged, this, [this, valueEditor]()
|
||||
@@ -108,7 +107,7 @@ void BCValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, c
|
||||
BCValueEditor* slider = qobject_cast<BCValueEditor*>(editor);
|
||||
if (slider)
|
||||
{
|
||||
int value = slider->getValue();
|
||||
int value = slider->value();
|
||||
model->setData(index, value, Qt::EditRole);
|
||||
}
|
||||
return;
|
||||
@@ -197,7 +196,11 @@ void BCValueDelegate::paintButtonIndicator(QPainter* painter, const QStyleOption
|
||||
void BCValueDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const
|
||||
{
|
||||
double ratio = bcValue.calcMinMaxRatio();
|
||||
qDebug() << " --- paint: " << bcValue.label() << ":" << ratio;
|
||||
|
||||
int value,min,max;
|
||||
bcValue.valuesForSlider( value, min, max );
|
||||
|
||||
qDebug() << " --- paint: " << bcValue.label() << " value: " << value << " min: " << min << " max: " << max << " ratio:" << ratio*100.0 << '%';
|
||||
|
||||
// Text und kleiner Slider-Indikator zeichnen
|
||||
painter->save();
|
||||
|
||||
Reference in New Issue
Block a user