summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Poelzleithner <git@poelzi.org>2020-11-04 20:04:55 +0100
committerDaniel Poelzleithner <git@poelzi.org>2020-11-27 01:08:33 +0100
commitf9d3f02e6863ce57738cd234612a870afcb34312 (patch)
treec2138331b2c82507beb174bd54b6730df794056f
parentb31cf4b61e071afd864a29f707f54b5af3f82607 (diff)
Properly open all submenus when using selectIndex on features
-rw-r--r--src/library/trackset/baseplaylistfeature.cpp2
-rw-r--r--src/widget/wlibrarysidebar.cpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/library/trackset/baseplaylistfeature.cpp b/src/library/trackset/baseplaylistfeature.cpp
index 86559219c3..fc41b58ae1 100644
--- a/src/library/trackset/baseplaylistfeature.cpp
+++ b/src/library/trackset/baseplaylistfeature.cpp
@@ -359,7 +359,7 @@ void BasePlaylistFeature::slotDeletePlaylist() {
if (m_pSidebarWidget) {
// FIXME: this does not scroll to the correct position for some reason
nextIndex = indexFromPlaylistId(nextId);
- m_pSidebarWidget->scrollTo(nextIndex);
+ m_pSidebarWidget->selectIndex(nextIndex);
}
}
}
diff --git a/src/widget/wlibrarysidebar.cpp b/src/widget/wlibrarysidebar.cpp
index 93fe776e23..f080437598 100644
--- a/src/widget/wlibrarysidebar.cpp
+++ b/src/widget/wlibrarysidebar.cpp
@@ -215,9 +215,16 @@ void WLibrarySidebar::selectIndex(const QModelIndex& index) {
pModel->select(index, QItemSelectionModel::Select);
setSelectionModel(pModel);
- if (index.parent().isValid()) {
- expand(index.parent());
+//FIXME(XXX): use expandRecursively when
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ QModelIndex parentIndex = index.parent();
+ if (parentIndex.isValid()) {
+ expand(parentIndex);
+ parentIndex = parentIndex.parent();
}
+#else
+ expandRecursively(index);
+#endif
scrollTo(index);
}