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

Fixed width of pinned tabs on all Qt styles.

closes #518
This commit is contained in:
nowrep 2012-09-02 12:22:11 +02:00
parent b2181f0bab
commit 1d919e0172
3 changed files with 17 additions and 16 deletions

View File

@ -31,11 +31,13 @@ int ProxyStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWid
return QProxyStyle::styleHint(hint, option, widget, returnData); 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
//{ {
// if (metric == PM_TabBarTabHSpace) { switch (metric) {
// return 8; case PM_TabBarTabHSpace:
// } return qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
// return QProxyStyle::pixelMetric(metric, option, widget); default:
//} return QProxyStyle::pixelMetric(metric, option, widget);
}
}

View File

@ -28,7 +28,8 @@ public:
explicit ProxyStyle(); explicit ProxyStyle();
int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const; 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;
int pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const;
}; };
#endif // PROXYSTYLE_H #endif // PROXYSTYLE_H

View File

@ -36,14 +36,6 @@
#define MAXIMUM_TAB_WIDTH 250 #define MAXIMUM_TAB_WIDTH 250
#define MINIMUM_TAB_WIDTH 125 #define MINIMUM_TAB_WIDTH 125
#ifdef Q_WS_WIN
#define PINNED_TAB_WIDTH 38
#elif defined(KDE)
#define PINNED_TAB_WIDTH 24
#else
#define PINNED_TAB_WIDTH 31
#endif
TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget) TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
: QTabBar() : QTabBar()
, p_QupZilla(mainClass) , p_QupZilla(mainClass)
@ -176,6 +168,12 @@ void TabBar::contextMenuRequested(const QPoint &position)
QSize TabBar::tabSizeHint(int index) const QSize TabBar::tabSizeHint(int index) const
{ {
static int PINNED_TAB_WIDTH = -1;
if (PINNED_TAB_WIDTH == -1) {
PINNED_TAB_WIDTH = 16 + style()->pixelMetric(QStyle::PM_TabBarTabHSpace);
}
QSize size = QTabBar::tabSizeHint(index); QSize size = QTabBar::tabSizeHint(index);
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index)); WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
TabBar* tabBar = const_cast <TabBar*>(this); TabBar* tabBar = const_cast <TabBar*>(this);