1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 12:46:35 +01:00

ComboTabBar: Force close button on right side

This mainly applies to macOS where close buttons are normally on left side,
but native macOS tabbar doesn't use icons and it looks wrong with icons.
This commit is contained in:
David Rosca 2018-02-16 11:44:19 +01:00
parent ec84df81e0
commit e4c2194177
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 10 additions and 2 deletions

View File

@ -36,9 +36,17 @@ int ProxyStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWid
case QStyle::SH_TabBar_Alignment: case QStyle::SH_TabBar_Alignment:
return Qt::AlignLeft; return Qt::AlignLeft;
case QStyle::SH_TabBar_CloseButtonPosition:
if (qobject_cast<const TabBarHelper*>(widget)) {
return QTabBar::RightSide;
}
break;
default: default:
return QProxyStyle::styleHint(hint, option, widget, returnData); break;
} }
return QProxyStyle::styleHint(hint, option, widget, returnData);
} }
int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const

View File

@ -760,7 +760,7 @@ QTabBar::ButtonPosition ComboTabBar::iconButtonPosition() const
QTabBar::ButtonPosition ComboTabBar::closeButtonPosition() const QTabBar::ButtonPosition ComboTabBar::closeButtonPosition() const
{ {
return (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); return (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, m_mainTabBar);
} }
QSize ComboTabBar::iconButtonSize() const QSize ComboTabBar::iconButtonSize() const