I'll leave the answer they gave me in another web:
You need to take the view's currentIndex(), which is a model index for the sorted/filter side of the proxy model, and use the proxy model's QSortFilterProxyModel::mapToSource() function to obtain a corresponding model index for the source model. Then you can use that index (if valid) to address the SQL model directly.