Skip to content

Commit

Permalink
audqt: Fix tab close buttons in dark theme with Qt 6.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
jlindgren90 committed Mar 8, 2024
1 parent a9d6280 commit 56e8705
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/libaudqt/dark-theme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,22 @@ class DarkStyle : public QProxyStyle
public:
DarkStyle() : QProxyStyle("fusion") {}

void polish(QApplication * app) override { QProxyStyle::polish(app); };
void polish(QApplication * app) override { QProxyStyle::polish(app); }
void polish(QWidget * widget) override { QProxyStyle::polish(widget); }
void polish(QPalette & palette) override;

/* Qt 6.3+ no longer uses the theme icon "window-close" for tabs,
* but instead forces a built-in icon. Override it back. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
QIcon standardIcon(StandardPixmap standardIcon,
const QStyleOption * option = nullptr,
const QWidget * widget = nullptr) const override
{
if (standardIcon == QStyle::SP_TabCloseButton)
return QIcon::fromTheme("window-close");
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
#endif
};

void DarkStyle::polish(QPalette & palette)
Expand Down

0 comments on commit 56e8705

Please sign in to comment.