mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Another Oxygen workaround for pinned tab width.
- it now also center site icon in the tab
This commit is contained in:
parent
3065d58b25
commit
30b8eaf44e
@ -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);
|
||||
|
||||
if (baseStyle()->objectName() == "oxygen") {
|
||||
m_TabBarTabHSpace = 14;
|
||||
}
|
||||
}
|
||||
|
||||
return m_TabBarTabHSpace;
|
||||
|
||||
default:
|
||||
return QProxyStyle::pixelMetric(metric, option, widget);
|
||||
}
|
||||
}
|
||||
|
@ -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.
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user