summaryrefslogtreecommitdiffstats
path: root/src/widget/wlibrarytableview.cpp
diff options
context:
space:
mode:
authorronso0 <ronso0@mixxx.org>2020-10-30 18:35:54 +0100
committerronso0 <ronso0@mixxx.org>2020-10-31 20:13:52 +0100
commite5974e4226a124d199985531888822e445e3d56e (patch)
tree00e1f9a5f207162db5a1d1d87272c31bb4647bc9 /src/widget/wlibrarytableview.cpp
parent2a888f96e174554aa5260219515e1c4e24cc4761 (diff)
WLibraryTableView::focusInEvent: workaround failing select with Qt::BacktabFocusReason
Diffstat (limited to 'src/widget/wlibrarytableview.cpp')
-rw-r--r--src/widget/wlibrarytableview.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widget/wlibrarytableview.cpp b/src/widget/wlibrarytableview.cpp
index 2f9897c847..06740d3bf9 100644
--- a/src/widget/wlibrarytableview.cpp
+++ b/src/widget/wlibrarytableview.cpp
@@ -172,8 +172,12 @@ void WLibraryTableView::focusInEvent(QFocusEvent* event) {
selectRow(0);
DEBUG_ASSERT(currentIndex().row() == 0);
} else {
- // Select the focused row
- selectRow(currentIndex().row());
+ // Select the row of the currently focused index.
+ // For some reason selectRow(currentIndex().row()) would not
+ // select for the first Qt::BacktabFocusReason in a session
+ // even though currentIndex() is valid.
+ selectionModel()->select(currentIndex(),
+ QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
DEBUG_ASSERT(currentIndex().isValid());