diff options
author | 2024-03-15 15:35:17 -0400 | |
---|---|---|
committer | 2024-03-15 15:35:17 -0400 | |
commit | a7f493366ac78cfdb426dd77ad272ae9d360da49 (patch) | |
tree | 9994480deb36d19537aa052371c135ea4f4ea608 /mapman | |
parent | e2fee8a707e28aacab93e7524f5ca965d6012f27 (diff) | |
download | meteor-trashy-addon-a7f493366ac78cfdb426dd77ad272ae9d360da49.tar.xz |
Scroll back after creating new entry and saving.
Diffstat (limited to 'mapman')
-rw-r--r-- | mapman/src/groupview.cpp | 9 |
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(); } |