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:
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user