From 6e166d139a81b53cbb50a8370d59f7269c3a10cb Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 20 Jun 2017 21:18:13 +0200 Subject: Fix alignment of scroll buttons in tab bar --- qutebrowser/mainwindow/tabwidget.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 2c4eb6eab..9168a28b6 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -759,6 +759,12 @@ class TabBarStyle(QCommonStyle): # style differences... rct = super().subElementRect(sr, opt, widget) return rct + elif sr == QStyle.SE_TabBarScrollLeftButton: + # We need this so the left scroll button is aligned properly. + # Otherwise, empty space will be shown after the last tab even + # though the button width is set to 0 + rct = super().subElementRect(sr, opt, widget) + return rct else: return self._style.subElementRect(sr, opt, widget) -- cgit v1.2.3-54-g00ecf From dfedddf0bdb0d803cd8b2d32d74977228c9d58da Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 20 Jun 2017 23:55:11 +0200 Subject: Wrap scroll button workaround in try/except for older pyqt5 versions (5.2.1) --- qutebrowser/mainwindow/tabwidget.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 9168a28b6..2096bf8e0 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -747,6 +747,8 @@ class TabBarStyle(QCommonStyle): Return: A QRect. """ + + if sr == QStyle.SE_TabBarTabText: layouts = self._tab_layout(opt) if layouts is None: @@ -759,13 +761,20 @@ class TabBarStyle(QCommonStyle): # style differences... rct = super().subElementRect(sr, opt, widget) return rct - elif sr == QStyle.SE_TabBarScrollLeftButton: - # We need this so the left scroll button is aligned properly. - # Otherwise, empty space will be shown after the last tab even - # though the button width is set to 0 - rct = super().subElementRect(sr, opt, widget) - return rct else: + try: + # We need this so the left scroll button is aligned properly. + # Otherwise, empty space will be shown after the last tab even + # though the button width is set to 0 + + # In older PyQt-versions (5.2.1) QStyle does not have this + # attribute. + if sr == QStyle.SE_TabBarScrollLeftButton: + return super().subElementRect(sr, opt, widget) + + except AttributeError: + pass + return self._style.subElementRect(sr, opt, widget) def _tab_layout(self, opt): -- cgit v1.2.3-54-g00ecf From f3a2b84033f0f25a298386e705839271df317157 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 20 Jun 2017 23:58:23 +0200 Subject: remove space --- qutebrowser/mainwindow/tabwidget.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 2096bf8e0..84cec79c8 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -747,8 +747,6 @@ class TabBarStyle(QCommonStyle): Return: A QRect. """ - - if sr == QStyle.SE_TabBarTabText: layouts = self._tab_layout(opt) if layouts is None: -- cgit v1.2.3-54-g00ecf From df6b8b7ff52d5fb5aedf911c03f319c85a1f54b9 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 21 Jun 2017 09:03:15 +0200 Subject: Update tabwidget.py --- qutebrowser/mainwindow/tabwidget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 84cec79c8..3dd0d28da 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -764,8 +764,8 @@ class TabBarStyle(QCommonStyle): # We need this so the left scroll button is aligned properly. # Otherwise, empty space will be shown after the last tab even # though the button width is set to 0 - - # In older PyQt-versions (5.2.1) QStyle does not have this + # + # In older PyQt-versions (5.2.1) QStyle does not have this # attribute. if sr == QStyle.SE_TabBarScrollLeftButton: return super().subElementRect(sr, opt, widget) -- cgit v1.2.3-54-g00ecf From a8120a23c4b24c203e07a8ca80105aa22c607e63 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Jul 2017 22:13:24 +0200 Subject: Update comment for TabBarStyle --- qutebrowser/mainwindow/tabwidget.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 3dd0d28da..d1beea7c7 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -765,11 +765,9 @@ class TabBarStyle(QCommonStyle): # Otherwise, empty space will be shown after the last tab even # though the button width is set to 0 # - # In older PyQt-versions (5.2.1) QStyle does not have this - # attribute. + # QStyle.SE_TabBarScrollLeftButton was added in Qt 5.7 if sr == QStyle.SE_TabBarScrollLeftButton: return super().subElementRect(sr, opt, widget) - except AttributeError: pass -- cgit v1.2.3-54-g00ecf From 0304040cbbf53043573a1b1104f4f0e9efd5ba02 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Jul 2017 22:14:01 +0200 Subject: Update docs --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index daa008a83..98e13a538 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -193,6 +193,7 @@ Contributors, sorted by the number of commits in descending order: * knaggita * Oliver Caldwell * Nikolay Amiantov +* Marius * Julian Weigt * Tomasz Kramkowski * Sebastian Frysztak @@ -217,7 +218,6 @@ Contributors, sorted by the number of commits in descending order: * Michał Góral * Michael Ilsaas * Martin Zimmermann -* Marius * Link * Jussi Timperi * Cosmin Popescu -- cgit v1.2.3-54-g00ecf