aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-03-15 15:35:17 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-03-15 15:35:17 -0400
commita7f493366ac78cfdb426dd77ad272ae9d360da49 (patch)
tree9994480deb36d19537aa052371c135ea4f4ea608
parente2fee8a707e28aacab93e7524f5ca965d6012f27 (diff)
downloadmeteor-trashy-addon-a7f493366ac78cfdb426dd77ad272ae9d360da49.tar.xz
Scroll back after creating new entry and saving.
-rw-r--r--mapman/src/groupview.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/mapman/src/groupview.cpp b/mapman/src/groupview.cpp
index 721917f..136607b 100644
--- a/mapman/src/groupview.cpp
+++ b/mapman/src/groupview.cpp
@@ -144,6 +144,7 @@ void group_view::add_group()
};
l->new_group(g);
refresh_list();
+ tv->scrollTo(mf->index(mf->rowCount() - 1, 0));
}
void group_view::rem_group()
@@ -209,6 +210,7 @@ void group_view::refresh_list()
m->setHorizontalHeaderLabels({"Title", "Author(s)", "Dimension", "id"});
tv->setColumnHidden(3, true);
auto gids = l->groups();
+ auto idx = QModelIndex();
for (auto gid : gids)
{
map_group_t g = l->get_group(gid);
@@ -219,7 +221,12 @@ void group_view::refresh_list()
i->setData(QVariant((qlonglong)gid), Qt::ItemDataRole::DisplayRole);
m->appendRow({t, a, d, i});
if (gid == curgid)
- tv->setCurrentIndex(t->index());
+ idx = mf->mapFromSource(t->index());
+ }
+ if (idx.isValid())
+ {
+ tv->setCurrentIndex(idx);
+ tv->scrollTo(idx);
}
tv->resizeColumnsToContents();
}