1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Another Oxygen workaround for pinned tab width.

- it now also center site icon in the tab
This commit is contained in:
nowrep 2012-09-03 15:28:37 +02:00
parent 3065d58b25
commit 30b8eaf44e
4 changed files with 18 additions and 9 deletions

View File

@ -19,6 +19,7 @@
ProxyStyle::ProxyStyle()
: QProxyStyle()
, m_TabBarTabHSpace(-1)
{
}
@ -33,9 +34,19 @@ int ProxyStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWid
int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
{
if (metric == PM_TabBarTabHSpace) {
return qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
}
switch (metric) {
case PM_TabBarTabHSpace:
if (m_TabBarTabHSpace == -1) {
m_TabBarTabHSpace = qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
return QProxyStyle::pixelMetric(metric, option, widget);
if (baseStyle()->objectName() == "oxygen") {
m_TabBarTabHSpace = 14;
}
}
return m_TabBarTabHSpace;
default:
return QProxyStyle::pixelMetric(metric, option, widget);
}
}

View File

@ -30,6 +30,9 @@ public:
int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const;
int pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const;
private:
mutable int m_TabBarTabHSpace;
};
#endif // PROXYSTYLE_H

Binary file not shown.

View File

@ -178,11 +178,6 @@ QSize TabBar::tabSizeHint(int index) const
if (PINNED_TAB_WIDTH == -1) {
PINNED_TAB_WIDTH = 16 + style()->pixelMetric(QStyle::PM_TabBarTabHSpace, 0, this);
// This method for some reason does not work very well with oxygen ...
if (mApp->currentStyle() == "oxygen") {
PINNED_TAB_WIDTH = 25;
}
}
QSize size = QTabBar::tabSizeHint(index);