From 50847f9e033ce5f4f009b5e0e739b0ac1975940f Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 30 Oct 2016 18:22:56 +0000 Subject: [PATCH] GUI: Setting the active tab also ensures it is visible in the tab bar --- gui/widgets/tab.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index ed261c98ec3..cf9dd5d9622 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -199,6 +199,12 @@ void TabWidget::setActiveTab(int tabID) { } _activeTab = tabID; _firstWidget = _tabs[tabID].firstWidget; + + // Also ensure the tab is visible in the tab bar + if (_firstVisibleTab > tabID) + _firstVisibleTab = tabID; + else if (_firstVisibleTab + _w / _tabWidth <= tabID) + _firstVisibleTab = tabID - _w / _tabWidth + 1; _boss->draw(); }