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.
This commit is contained in:
parent
58043b5653
commit
dc1d5036b6
@ -23,7 +23,7 @@ Defines a CompletionView which uses CompletionFiterModel and CompletionModel
|
|||||||
subclasses to provide completions.
|
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 PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QItemSelectionModel, QSize
|
||||||
|
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
@ -152,7 +152,7 @@ class CompletionView(QTreeView):
|
|||||||
column_widths = self.model().column_widths
|
column_widths = self.model().column_widths
|
||||||
pixel_widths = [(width * perc // 100) for perc in 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:
|
if pixel_widths[-1] > delta:
|
||||||
pixel_widths[-1] -= delta
|
pixel_widths[-1] -= delta
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user