From 6e9d24212db60743f13497f942713961d6601844 Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Fri, 16 Jun 2017 17:06:53 -0400 Subject: QTabBar: fix expanded tabs appearance Fix regression introduced by 175f33ed8. 'expanding' property set to true was ignored when QStyle::styleHint() returned Qt::AlignRight for SH_TabBar_Alignment. When we calculate tabs geometry, we put an empty tab at the front and back and set its expansive attribute depending on tab alignment AND 'expanding' property. Task-number: QTBUG-61480 Change-Id: I6a1827ae8a3f2c6bee5124c18c7f2b1c0a7862f3 Reviewed-by: Gabriel de Dietrich --- tests/manual/qtabbar/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/manual/qtabbar') diff --git a/tests/manual/qtabbar/main.cpp b/tests/manual/qtabbar/main.cpp index b1ef0df100..5a1a558c10 100644 --- a/tests/manual/qtabbar/main.cpp +++ b/tests/manual/qtabbar/main.cpp @@ -56,12 +56,28 @@ #include #include #include +#include + +class MyProxyStyle : public QProxyStyle +{ +public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_TabBar_Alignment) + return Qt::AlignLeft; +// return Qt::AlignRight; +// return Qt::AlignCenter; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; const int TabCount = 5; int main(int argc, char *argv[]) { QApplication app(argc, argv); + app.setStyle(new MyProxyStyle); QWidget widget; QStackedWidget stackedWidget; @@ -69,7 +85,7 @@ int main(int argc, char *argv[]) tabBar.setDocumentMode(true); tabBar.setTabsClosable(true); tabBar.setMovable(true); - tabBar.setExpanding(true); + tabBar.setExpanding(false); // top tabBar.setShape(QTabBar::RoundedNorth); -- cgit v1.2.3