Make tabbar style hack less intrusive
This commit is contained in:
parent
e5eadd1315
commit
83a90e0c05
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue