Added getUuid(itemIndex) to proxy model to prevent using IdRole in UI when an item should be referenced (i. e. for deletion on server).

This commit is contained in:
2026-02-02 16:46:10 +01:00
parent db1ecbece0
commit ba482e6e17
2 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,10 @@ QItemSelection GeneralSortFilterModel::findItems(const QString& text) const {
return result;
}
QString GeneralSortFilterModel::getUuid(const QModelIndex& itemIndex) const {
return data(itemIndex, IdRole).toString();
}
QByteArray GeneralSortFilterModel::jsonDataForServer(const QModelIndex& proxyIndex) {
const QModelIndex sourceIndex = mapToSource(proxyIndex);
return m_tableModel->jsonDataForServer(sourceIndex);

View File

@ -17,6 +17,7 @@ class GeneralSortFilterModel : public QSortFilterProxyModel {
* @return QItemSelection containing all successful ModelIndex results
*/
QItemSelection findItems(const QString& text) const;
QString getUuid(const QModelIndex& itemIndex) const;
QByteArray jsonDataForServer(const QModelIndex& proxyIndex);