lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
586 stars 150 forks source link

Regression in Qt6: inactive tab may have elided text #1112

Closed tsujan closed 2 months ago

tsujan commented 2 months ago
Steps to Reproduce (for bugs)
  1. Unckeck Terminal Settings → Appearance → Fixed tab width
  2. Open two tabs, such that the text of the active tab (in bold) is NOT elided.

Then the text of the inactive tab may be elided, while it's the same as the text of the active tab.

This happens with all Qt styles. A screenshot with Fusion:

elided

Context

I think it's about a change in Qt6.

System Information

Latest git version.

tsujan commented 2 months ago

Apparently, in Qt6, QStyle::sizeFromContents(QStyle::CT_TabBarTab, ...) of the widget style isn't called anymore for the inactive tab when there is a style sheet like "QTabBar::tab:!selected { font-weight: normal; }", as there is in our tabbar.cpp. Therefore, the width of the inactive tab is different from the active one, although they have the same text.

In short, our trick in the c-tor of TabBar doesn't work with Qt6 (or at least with Qt ≥ 6.7, which I have here), while it worked with Qt5.