Qt: fix saving exported objects after sorting columns

Avoid assuming an export object's row number is consistent throughout,
because the row number can change if the display is filtered or sorted.
Instead, look up the index in the model with mapToSource().

Bug: 14545
Change-Id: I61099dfb4f3abc056417eb7d6ffbc7a988553dd8
Reviewed-on: https://code.wireshark.org/review/30388
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Moshe Kaplan 2018-10-25 20:54:51 -04:00 committed by Peter Wu
parent da8e69e158
commit 4a2739ec88
1 changed files with 5 additions and 1 deletions

View File

@ -145,7 +145,11 @@ void ExportObjectDialog::saveCurrentEntry()
{
QDir path(wsApp->lastOpenDir());
QModelIndex current = eo_ui_->objectTree->currentIndex();
QModelIndex proxyIndex = eo_ui_->objectTree->currentIndex();
if (!proxyIndex.isValid())
return;
QModelIndex current = proxyModel_.mapToSource(proxyIndex);
if (!current.isValid())
return;