Start with the current data, when editing a table cell.

This commit is contained in:
2025-12-06 14:34:17 +01:00
parent a07e03d80d
commit 144460b5aa
2 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,6 @@ QString GenericCore::getMaintenanceToolFilePath() const {
/// setting the applicationDirPath hard coded to test update feature from IDE /// setting the applicationDirPath hard coded to test update feature from IDE
#ifdef QT_DEBUG #ifdef QT_DEBUG
// REFACTOR retrieve application name automatically instead of using hard coded name
applicationDirPath = QString("/opt/%1").arg(APPLICATION_NAME); applicationDirPath = QString("/opt/%1").arg(APPLICATION_NAME);
#endif #endif

View File

@ -11,7 +11,7 @@ static const QHash<int, QByteArray> ROLE_NAMES = {{NameRole, "Name"},
TableModel::TableModel(QObject* parent) TableModel::TableModel(QObject* parent)
: QAbstractTableModel{parent} { : QAbstractTableModel{parent} {
for (int row = 0; row < 23; ++row) { for (int row = 0; row < 5; ++row) {
QHash<int, QVariant> values; QHash<int, QVariant> values;
values[NameRole] = QString("Item %1").arg(row); values[NameRole] = QString("Item %1").arg(row);
values[DescriptionRole] = QString("This is item %1").arg(row); values[DescriptionRole] = QString("This is item %1").arg(row);
@ -46,6 +46,7 @@ QVariant TableModel::data(const QModelIndex& index, int role) const {
int roleForColumn = getRoleForColumn(column); int roleForColumn = getRoleForColumn(column);
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
case Qt::EditRole:
return m_items.at(row)->data(roleForColumn); return m_items.at(row)->data(roleForColumn);
} }