Fix mouse wheel not working in diff view

This commit is contained in:
Kovid Goyal 2014-04-11 21:54:26 +05:30
parent f1842ae443
commit abf157b816
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,8 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# QT5XX: See why mouse wheel is not working in diff view # QT5XX: Port def wheelEvent() (orientation() and delta() to be replaced by
# angleDelta())
# QT5XX: Delete this file after migration is completed # QT5XX: Delete this file after migration is completed

View File

@ -381,7 +381,7 @@ class TextBrowser(PlainTextEdit): # {{{
painter.drawLine(0, bottom - 1, w, bottom - 1) painter.drawLine(0, bottom - 1, w, bottom - 1)
def wheelEvent(self, ev): def wheelEvent(self, ev):
if ev.orientation() == Qt.Vertical: if ev.angleDelta().x() == 0:
self.wheel_event.emit(ev) self.wheel_event.emit(ev)
else: else:
return PlainTextEdit.wheelEvent(self, ev) return PlainTextEdit.wheelEvent(self, ev)
@ -488,7 +488,7 @@ class DiffSplitHandle(QSplitterHandle): # {{{
return ans return ans
def wheelEvent(self, ev): def wheelEvent(self, ev):
if ev.orientation() == Qt.Vertical: if ev.angleDelta().x() == 0:
self.wheel_event.emit(ev) self.wheel_event.emit(ev)
else: else:
return QSplitterHandle.wheelEvent(self, ev) return QSplitterHandle.wheelEvent(self, ev)