Mini-Breakthrough: Animantion works.

This commit is contained in:
2025-12-29 20:10:05 +01:00
parent 4491e6fe57
commit 60be19a6ae
11 changed files with 282 additions and 284 deletions

View File

@@ -31,6 +31,7 @@
#include <bcvaluemodel.h>
#include <bcvaluetype.h>
/**
* @brief Konstruktor, ohne Besonderheiten
@@ -94,7 +95,7 @@ void BCValueModel::takeValueList(BCValueList& newValueList)
void BCValueModel::onValueUpdated( int row, BC::State state, const QString& newVisisbleValue )
{
qDebug() << " Panel update: " << newVisisbleValue;
qDebug() << " BCValueModel::onValueUpdated update: " << newVisisbleValue;
if( row > -1 && row < _valueList.size() )
{
const BCValue& value = _valueList[row];
@@ -160,41 +161,53 @@ QVariant BCValueModel::headerData(int section, Qt::Orientation orientation, int
/**
* @brief Gibt die Model-Daten zurück. Das Model Gibt hier, unabhängig von der DataRole, immer das
* gesamte BCValue Object zurück. Die Umsetzung von Status- und Typeinfromationen in GUI-Elemente
* findet nicht hier, sondern im BCDelagate statt.
* @brief Gibt die Model-Daten zurück.
*/
QVariant BCValueModel::data(const QModelIndex& index, int role) const
{
Q_UNUSED(role)
/*
// Bonus: Rechtsbündig für Zahlen
if (role == Qt::TextAlignmentRole && (index.column() == 0 || index.column() == 2)) {
return Qt::AlignRight | Qt::AlignVCenter;
}
int row = index.row();
int col = index.column();
return QVariant();
*/
int row = index.row();
if (!index.isValid() || row >= _valueList.size())
bool wrongRole = ( role != Qt::DisplayRole && role != Qt::EditRole);
if (wrongRole || !index.isValid() || row >= _valueList.size() )
return QVariant();
const BCValue* entry = &_valueList.at( row );
return QVariant::fromValue( entry );
const BCValue& value = _valueList.at( row );
/*
if (role == Qt::DisplayRole || role == Qt::EditRole)
if( col == 0 )
return value.label;
if( col == 1)
{
if( col == 0 )
return entry.label;
else if( col == 1 )
return entry.visibleValue;
if( role == Qt::DisplayRole )
return QString("%1 %2").arg( value.visibleValue, value.valueType->unitLabel);
return value.visibleValue;
}
*/
return QVariant();
/*
Das Model Gibt hier, unabhängig von der DataRole, immer das
* gesamte BCValue Object zurück. Die Umsetzung von Status- und Typeinfromationen in GUI-Elemente
* findet nicht hier, sondern im BCDelagate statt.
// falsch! wie geben hier doch ordentlich die einzelwerte zurück
// Bonus: Rechtsbündig für Zahlen
if (role == Qt::TextAlignmentRole && (index.column() == 0 || index.column() == 2)) {
return Qt::AlignRight | Qt::AlignVCenter;
}
//return QVariant::fromValue( entry );
return QVariant();
*/
}