Revert "remove MacOSTabFixStyle"

This reverts commit 28e53f97a4.

Update tab_supervisor.cpp
This commit is contained in:
tooomm 2026-08-28 13:09:18 +02:00
parent 3bc08ef94c
commit 6af2666018
2 changed files with 26 additions and 0 deletions

View file

@ -49,6 +49,18 @@
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/settings/tabs_settings.h>
QRect MacOSTabFixStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
if (element != SE_TabBarTabText) {
return QProxyStyle::subElementRect(element, option, widget);
}
// Skip over QProxyStyle handling subElementRect,
// This fixes an issue on macOS where the labels for tabs with a button and an icon
// get cut-off too early
return QCommonStyle::subElementRect(element, option, widget);
}
CloseButton::CloseButton(QWidget *parent) : QAbstractButton(parent)
{
setFocusPolicy(Qt::NoFocus);
@ -112,6 +124,12 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
setMovable(true);
setIconSize(QSize(15, 15));
#if defined(Q_OS_MAC)
// This is necessary to fix an issue on macOS,
// where tabs with icons and buttons get drawn incorrectly
tabBar()->setStyle(new MacOSTabFixStyle);
#endif
userListManager = new UserListManager(client, this);
// connect tab changes

View file

@ -22,6 +22,7 @@
#include <QAbstractButton>
#include <QLoggingCategory>
#include <QMap>
#include <QProxyStyle>
#include <QTabWidget>
#include <libcockatrice/network/client/abstract/latency_tracker.h>
@ -55,6 +56,13 @@ class ServerInfo_User;
class GameReplay;
class DeckList;
class MacOSTabFixStyle : public QProxyStyle
{
Q_OBJECT
public:
QRect subElementRect(SubElement, const QStyleOption *, const QWidget *) const override;
};
class CloseButton : public QAbstractButton
{
Q_OBJECT