diff options
| author | Michael Maltese <mchtly@gmail.com> | 2017-07-16 15:05:39 -0700 |
|---|---|---|
| committer | Michael Maltese <mchtly@gmail.com> | 2017-07-16 18:23:59 -0700 |
| commit | 2b712bdbaa3cb1ba7c8eec9faa7a4c602209df83 (patch) | |
| tree | 634d6111de37f923eb04014a2f6ff35e7dadd432 | |
| parent | 19dc580a4eed0e48198b1cb5bb453cccbb8e25ee (diff) | |
ListTabWidget: disallow deselecting items
| -rw-r--r-- | Source/Core/DolphinQt2/QtUtils/ListTabWidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DolphinQt2/QtUtils/ListTabWidget.cpp b/Source/Core/DolphinQt2/QtUtils/ListTabWidget.cpp index bf7aa41f5c..a7a94618c2 100644 --- a/Source/Core/DolphinQt2/QtUtils/ListTabWidget.cpp +++ b/Source/Core/DolphinQt2/QtUtils/ListTabWidget.cpp @@ -21,6 +21,15 @@ public: int height = QListWidget::sizeHint().height(); return {width, height}; } + + // Since this is trying to emulate tabs, an item should always be selected. If the selection tries + // to change to empty, don't acknowledge it. + void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) override + { + if (selected.indexes().empty()) + return; + QListWidget::selectionChanged(selected, deselected); + } }; ListTabWidget::ListTabWidget() @@ -40,8 +49,6 @@ ListTabWidget::ListTabWidget() connect(m_labels, &QListWidget::currentItemChanged, this, [=](QListWidgetItem* current, QListWidgetItem* previous) { - if (!current) - current = previous; m_display->setCurrentIndex(m_labels->row(current)); }); } |
