From dc1d5036b6d11b7971b31345322e4e8b0c7e1c6f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 14 Dec 2017 09:39:07 +0100 Subject: [PATCH] Simplify scrollbar width calculation This gives us slightly different values it seems, but I think they are more correct (and don't need the "+ 5" above). Taking the width directly (not the sizeHint width) returned values like 100 or so when the scrollbar wasn't shown yet, so that seems wrong. --- qutebrowser/completion/completionwidget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 2cfc6db7a..f1be785e1 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -23,7 +23,7 @@ Defines a CompletionView which uses CompletionFiterModel and CompletionModel subclasses to provide completions. """ -from PyQt5.QtWidgets import QStyle, QTreeView, QSizePolicy, QStyleFactory +from PyQt5.QtWidgets import QTreeView, QSizePolicy, QStyleFactory from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QItemSelectionModel, QSize from qutebrowser.config import config @@ -152,7 +152,7 @@ class CompletionView(QTreeView): column_widths = self.model().column_widths pixel_widths = [(width * perc // 100) for perc in column_widths] - delta = self.style().pixelMetric(QStyle.PM_ScrollBarExtent) + 5 + delta = self.verticalScrollBar().sizeHint().width() if pixel_widths[-1] > delta: pixel_widths[-1] -= delta else: