mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ebook viewer image popup: ALlow using the mouse wheel to zoom the image
This commit is contained in:
parent
f8af6aacde
commit
765f503045
@ -105,6 +105,14 @@ class ImageView(QDialog):
|
||||
gprefs['viewer_image_popup_geometry'] = bytearray(self.saveGeometry())
|
||||
return QDialog.done(self, e)
|
||||
|
||||
def wheelEvent(self, event):
|
||||
if event.delta() < -14:
|
||||
self.zoom_out()
|
||||
event.accept()
|
||||
elif event.delta() > 14:
|
||||
event.accept()
|
||||
self.zoom_in()
|
||||
|
||||
class ImagePopup(object):
|
||||
|
||||
def __init__(self, parent):
|
||||
@ -126,3 +134,12 @@ class ImagePopup(object):
|
||||
if not d.isVisible():
|
||||
self.dialogs.remove(d)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
app = QApplication([])
|
||||
p = QPixmap()
|
||||
p.load(sys.argv[-1])
|
||||
u = QUrl.fromLocalFile(sys.argv[-1])
|
||||
d = ImageView(None, p, u)
|
||||
d()
|
||||
app.exec_()
|
||||
|
Loading…
x
Reference in New Issue
Block a user