mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Finish porting of QWheelEvent
This commit is contained in:
parent
615d1104d2
commit
5c2bcdf8fc
@ -11,9 +11,6 @@ __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
# https://github.com/ariya/phantomjs/pull/173 for info on how to enable fonts
|
||||
# with fontconfig (probably needed for PDF output and SVG rendering)
|
||||
|
||||
# QT5XX: Port def wheelEvent() (orientation() and delta() to be replaced by
|
||||
# angleDelta())
|
||||
|
||||
# QT5XX: Add a import checker that looks for all from PyQt5.* imports and runs
|
||||
# them to check that they work. This can probably be made part of python
|
||||
# setup.py check.
|
||||
|
@ -154,11 +154,10 @@ if pictureflow is not None:
|
||||
return self.minimumSize()
|
||||
|
||||
def wheelEvent(self, ev):
|
||||
ev.accept()
|
||||
if ev.delta() < 0:
|
||||
self.showNext()
|
||||
elif ev.delta() > 0:
|
||||
self.showPrevious()
|
||||
d = ev.angleDelta().y()
|
||||
if abs(d) > 0:
|
||||
ev.accept()
|
||||
(self.showNext if d < 0 else self.showPrevious)()
|
||||
|
||||
def dataChanged(self):
|
||||
self.dc_signal.emit()
|
||||
|
@ -235,9 +235,10 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
self.document.back()
|
||||
|
||||
def wheelEvent(self, ev):
|
||||
if ev.delta() >= 0:
|
||||
d = ev.angleDelta().y()
|
||||
if d > 0:
|
||||
self.document.previous()
|
||||
else:
|
||||
elif d < 0:
|
||||
self.document.next()
|
||||
|
||||
def closeEvent(self, event):
|
||||
|
@ -18,7 +18,7 @@ class ImageView(QDialog):
|
||||
def __init__(self, parent, current_img, current_url, geom_name='viewer_image_popup_geometry'):
|
||||
QDialog.__init__(self)
|
||||
dw = QApplication.instance().desktop()
|
||||
self.avail_geom = dw.availableGeometry(parent)
|
||||
self.avail_geom = dw.availableGeometry(parent if parent is not None else self)
|
||||
self.current_img = current_img
|
||||
self.current_url = current_url
|
||||
self.factor = 1.0
|
||||
@ -113,12 +113,10 @@ class ImageView(QDialog):
|
||||
return QDialog.done(self, e)
|
||||
|
||||
def wheelEvent(self, event):
|
||||
if event.delta() < -14:
|
||||
self.zoom_out()
|
||||
d = event.angleDelta().y()
|
||||
if abs(d) > 0 and not self.scrollarea.verticalScrollBar().isVisible():
|
||||
event.accept()
|
||||
elif event.delta() > 14:
|
||||
event.accept()
|
||||
self.zoom_in()
|
||||
(self.zoom_out if d < 0 else self.zoom_in)()
|
||||
|
||||
class ImagePopup(object):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user