Fix mode tab bar sizing on monitors with different DPI scale factors#360
Open
hendorog wants to merge 2 commits into
Open
Fix mode tab bar sizing on monitors with different DPI scale factors#360hendorog wants to merge 2 commits into
hendorog wants to merge 2 commits into
Conversation
Dynamically update the mode tab bar height when the menu bar resizes due to screen DPI changes, instead of using a fixed pixel value captured at startup. Previously, moving the window to a monitor with a different scale factor left the tab bar at its original size, breaking menu bar layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The corner widget (tab bar) is embedded in the menu bar, so reading menuBar()->height() and writing it back to the corner widget caused infinite growth. Compute the target height from font metrics and style margins instead, which are DPI-aware but independent of the menu bar's current layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The mode tab bar (embedded in the menu bar as a corner widget) gets its
height from
menuBar()->height()once at startup and bakes it into astylesheet as a fixed pixel value. Two problems result:
resizes the menu bar, but the tab bar keeps its startup height,
breaking the menu bar layout.
the menu bar's own layout: the corner widget is inside the menu bar,
so reading its height and writing it back caused unbounded growth of
the menu/toolbar area.
Fix
and update the tab bar height dynamically.
are DPI-aware but independent of the menu bar's current layout, so no
feedback loop is possible. Skip the update when the height is
unchanged.
Tested on Windows with a laptop display + two external monitors at
different scale factors: tab bar now tracks the menu bar height
correctly when dragging the window between monitors, with no growth
loop on fractional scaling.