Changed value handling.
This commit is contained in:
@@ -37,17 +37,17 @@
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QTableView>
|
||||
|
||||
#include <QVariantAnimation>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QPainter>
|
||||
|
||||
#include <bcdeviceview.h>
|
||||
#include <bcvaluedelegate.h>
|
||||
|
||||
#include <bcvalueeditor.h>
|
||||
|
||||
BCValueDelegate::BCValueDelegate(const BCValueList& valueList, QTableView* view)
|
||||
|
||||
BCValueDelegate::BCValueDelegate(const BCValueList& valueList, BCDeviceView* view)
|
||||
: QStyledItemDelegate{view}, _valueList{valueList}, _view{view}
|
||||
{
|
||||
|
||||
@@ -56,20 +56,32 @@ BCValueDelegate::BCValueDelegate(const BCValueList& valueList, QTableView* view)
|
||||
|
||||
QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||
{
|
||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(index)
|
||||
|
||||
auto* valueEditor = new BCValueEditor(bcValue, parent);
|
||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||
|
||||
|
||||
qDebug() << " --- upsy: " << bcValue.getLabel() << " ratio: " << bcValue.calcMinMaxRatio() << " raw: " << bcValue.getRawValue() << " scaled: " << bcValue.getScaledValue();
|
||||
|
||||
auto* valueEditor = new BCValueEditor(bcValue.getScaledValue(), parent);
|
||||
|
||||
// Signal für sofortige Updates
|
||||
connect(valueEditor, &BCValueEditor::valueChanged, this, [this, valueEditor](int newValue)
|
||||
connect(valueEditor, &BCValueEditor::valueChanged, this, [this, valueEditor]()
|
||||
{
|
||||
// Commit data sofort bei Änderung
|
||||
emit const_cast<BCValueDelegate*>(this)->commitData(valueEditor);
|
||||
});
|
||||
|
||||
// Signal für sofortige Updates
|
||||
connect(valueEditor, &BCValueEditor::valueCommited, this, [this, valueEditor](int newValue)
|
||||
{
|
||||
qDebug() << " --- value set:" << newValue;
|
||||
// Commit data sofort bei Änderung
|
||||
//emit const_cast<BCValueDelegate*>(this)->commitData(valueEditor);
|
||||
});
|
||||
|
||||
return valueEditor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user