Skip to content

fix(ui): keep tab label clear of its icon on macOS - #1998

Open
jl-martins wants to merge 2 commits into
zealdocs:mainfrom
jl-martins:fix-macos-tab-icon-overlap
Open

jl-martins wants to merge 2 commits into
zealdocs:mainfrom
jl-martins:fix-macos-tab-icon-overlap

Conversation

@jl-martins

@jl-martins jl-martins commented Oct 7, 2026 •

Copy link
Copy Markdown

Problem and Solution

#1906 left-aligned browser tab labels by changing the alignment of the centered text in ProxyStyle::drawItemText(). In document mode, the macOS style places the tab icon next to where the centered text would be, causing the left-aligned label to be drawn over it.

For browser tabs on the macOS style, paint the icon at the leading edge in ProxyStyle. Give the base style an icon-less option narrowed by the icon width plus a 4px gap, the same gap that QCommonStyle and QMacStyle use. Return the matching SE_TabBarTabText rect from subElementRect() so that QTabBar cuts titles to the width of the label. Other styles are not affected.

Before

zeal_tab_macos_icon_and_text_overlap

After

Regular tab

zeal_tab_macos_fixed

Narrow tabs

zeal_tab_macos_ellision

Right-to-left (--reverse)

zeal_macos_tab_reversed

Summary by CodeRabbit

  • Bug Fixes
    • Improved icon and label alignment in document-mode tabs using the macOS style. Icons now sit beside the text without overlapping it, and title truncation follows the adjusted label position. This applies to rounded and triangular tabs along the top or bottom edge. Other tabs continue to use the existing style behavior. These adjustments keep tab icons and titles clearly separated while preserving the established appearance of other tab styles.

@jl-martins
jl-martins requested a review from trollixx as a code owner October 7, 2026 12:28
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 9cb8137c-1c7e-4e8c-9b61-52c9529cf986
📥 Commits

Reviewing files that changed from the base of the PR and between 1106afe and cf3fcca.

📒 Files selected for processing (1)
  • src/libs/ui/widgets/proxystyle.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

ProxyStyle adjusts icon and label placement for document-mode tabs with icons when they use the macOS base style. It also returns the adjusted text rectangle for these tabs. Other tabs continue to use the base-style path.

Changes

Document-Mode Tab Icon Layout

Layer / File(s) Summary
Tab label geometry
src/libs/ui/widgets/proxystyle.h, src/libs/ui/widgets/proxystyle.cpp
ProxyStyle declares helpers and checks tab eligibility. It computes icon and label geometry using the actual icon size, falling back to PM_SmallIconSize when needed, and accounts for text direction and a 4-pixel gap.
Tab painting and text geometry
src/libs/ui/widgets/proxystyle.h, src/libs/ui/widgets/proxystyle.cpp
For eligible tabs, ProxyStyle paints the icon before the adjusted label and returns the adjusted text rectangle. Tabs without icons retain the base-style path.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to cf3fc

The tab-label adjustment is limited to the eligible macOS document-mode tabs, with matching geometry used for painting and text measurement. No actionable merge risk is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: preventing macOS tab labels from overlapping their icons.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jl-martins
jl-martins force-pushed the fix-macos-tab-icon-overlap branch from 5603d81 to 1106afe Compare October 7, 2026 12:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant