Compare commits

...

2 commits

Author SHA1 Message Date
tooomm
29d9b6d6b6 fix indentation 2026-08-28 13:31:07 +02:00
tooomm
6af2666018 Revert "remove MacOSTabFixStyle"
This reverts commit 28e53f97a4.

Update tab_supervisor.cpp
2026-08-28 13:10:51 +02:00
3 changed files with 28 additions and 2 deletions

View file

@ -370,6 +370,6 @@ LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create start menu items for Cockat
LangString DESC_UnSecApplication ${LANG_ENGLISH} "Cockatrice program files and start menu items"
LangString DESC_UnSecConfiguration ${LANG_ENGLISH} "Configurations, decks, card database, pictures"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication)
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecConfiguration} $(DESC_UnSecConfiguration)
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication)
!insertmacro MUI_DESCRIPTION_TEXT ${UnSecConfiguration} $(DESC_UnSecConfiguration)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END

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