Truly independent web browser
UI/Qt: Move vertical tab buttons into place before showing them
Andreas Klingff364d445a64
diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cppindex 1e0986c0d29..3572919e5b3 100644--- a/UI/Qt/TabBar.cpp+++ b/UI/Qt/TabBar.cpp@@ -2182,14 +2182,9 @@ void TabBar::update_tab_button_geometry()? x - 6 >= icon_left + TAB_ICON_SIZE: x + button_size.width() + 6 + TAB_ICON_SIZE <= shape_rect.right() - TAB_CONTENT_HORIZONTAL_INSET;- auto should_be_visible = index != dragged_index && has_room_for_icon- && (position != QTabBar::RightSide || index == currentIndex() || index == m_hovered_tab_index);+ // NB: Move a button before showing it. Shown where it was, under the pointer, it would take a hover that it+ // keeps at its new place until the pointer moves.auto did_update_button = false;- if (button->isVisible() != should_be_visible) {- button->setVisible(should_be_visible);- did_update_button = true;- }-auto y = shape_rect.top() + ((shape_rect.height() - button_size.height()) / 2);QRect button_geometry { { x, y }, button_size };if (button->geometry() != button_geometry) {@@ -2197,6 +2192,13 @@ void TabBar::update_tab_button_geometry()did_update_button = true;}+ auto should_be_visible = index != dragged_index && has_room_for_icon+ && (position != QTabBar::RightSide || index == currentIndex() || index == m_hovered_tab_index);+ if (button->isVisible() != should_be_visible) {+ button->setVisible(should_be_visible);+ did_update_button = true;+ }+if (did_update_button)button->raise();};@@ -2207,14 +2209,6 @@ void TabBar::update_tab_button_geometry()return;prepare_button(button, true);- auto should_be_visible = index != dragged_index- && (position == QTabBar::LeftSide || (index == m_hovered_tab_index && !m_tab_widget->can_expand_vertical_tabs_on_hover()));- bool did_update_button = false;- if (button->isVisible() != should_be_visible) {- button->setVisible(should_be_visible);- did_update_button = true;- }-auto button_size = button->size();if (button_size.isEmpty())button_size = button->sizeHint();@@ -2233,12 +2227,21 @@ void TabBar::update_tab_button_geometry()button_position = { x, y };}+ // NB: As above, move the button before showing it.+ bool did_update_button = false;QRect button_geometry { button_position, button_size };if (button->geometry() != button_geometry) {button->setGeometry(button_geometry);did_update_button = true;}+ auto should_be_visible = index != dragged_index+ && (position == QTabBar::LeftSide || (index == m_hovered_tab_index && !m_tab_widget->can_expand_vertical_tabs_on_hover()));+ if (button->isVisible() != should_be_visible) {+ button->setVisible(should_be_visible);+ did_update_button = true;+ }+if (did_update_button)button->raise();};