mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Linux: Fix slow mouse wheel scrolling in Cover grid because of Qt bug
This commit is contained in:
parent
eddc49fa44
commit
5311b5155e
@ -1020,13 +1020,13 @@ class GridView(QListView):
|
|||||||
return super(GridView, self).selectionCommand(index, event)
|
return super(GridView, self).selectionCommand(index, event)
|
||||||
|
|
||||||
def wheelEvent(self, ev):
|
def wheelEvent(self, ev):
|
||||||
if ev.phase() not in (Qt.ScrollUpdate, 0):
|
if ev.phase() not in (Qt.ScrollUpdate, Qt.NoScrollPhase):
|
||||||
# 0 is Qt.NoScrollPhase which is not yet available in PyQt
|
|
||||||
return
|
return
|
||||||
number_of_pixels = ev.pixelDelta()
|
number_of_pixels = ev.pixelDelta()
|
||||||
number_of_degrees = ev.angleDelta() / 8
|
number_of_degrees = ev.angleDelta() / 8.0
|
||||||
b = self.verticalScrollBar()
|
b = self.verticalScrollBar()
|
||||||
if number_of_pixels.isNull():
|
if number_of_pixels.isNull() or islinux:
|
||||||
|
# pixelDelta() is broken on linux with wheel mice
|
||||||
dy = number_of_degrees.y() / 15.0
|
dy = number_of_degrees.y() / 15.0
|
||||||
# Scroll by approximately half a row
|
# Scroll by approximately half a row
|
||||||
dy = int(math.ceil((dy) * b.singleStep() / 2.0))
|
dy = int(math.ceil((dy) * b.singleStep() / 2.0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user