diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 8a38ae08..b619cf19 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -422,7 +422,18 @@ class FancyTabWidgetProxyStyle : public QProxyStyle { ~FancyTabWidgetProxyStyle() override { common_style_->deleteLater(); } QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const override { - return common_style_->subElementRect(element, option, widget); + if (element == QStyle::SE_TabWidgetTabBar) { + QRect proxy_style_rect = QProxyStyle::subElementRect(element, option, widget); + QRect commonstyle_rect = common_style_->subElementRect(element, option, widget); + // Make the tabs align on top instead of the middle (macOS style hack). + if (proxy_style_rect.y() > 10) proxy_style_rect.setY(commonstyle_rect.y()); + // Fix stretched tabbar (Fedora/Gnome style issue). + proxy_style_rect.setHeight(commonstyle_rect.height()); + return proxy_style_rect; + } + else { + return QProxyStyle::subElementRect(element, option, widget); + } } private: