Rework itemdelegate, part I.

This commit is contained in:
2025-12-29 15:44:06 +01:00
parent 527f66759f
commit 0bb39a74fe
10 changed files with 64 additions and 147 deletions

View File

@@ -140,10 +140,6 @@ int BCValueModel::columnCount(const QModelIndex& parent) const
/**
* @brief Gibt die Header-Einträge zurück
* @param section
* @param orientation
* @param role
* @return
*/
QVariant BCValueModel::headerData(int section, Qt::Orientation orientation, int role) const
@@ -162,9 +158,18 @@ 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.
*/
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;
@@ -172,14 +177,14 @@ QVariant BCValueModel::data(const QModelIndex& index, int role) const
return QVariant();
*/
int row = index.row();
int col = index.column();
int row = index.row();
if (!index.isValid() || row >= _valueList.size())
return QVariant();
const BCValue* entry = &_valueList.at( row );
return QVariant::fromValue( entry );
const BCValue& entry = _valueList.at( row );
/*
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
if( col == 0 )
@@ -187,8 +192,9 @@ QVariant BCValueModel::data(const QModelIndex& index, int role) const
else if( col == 1 )
return entry.visibleValue;
}
*/
return QVariant();
}