5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog showing a pixmap. |
7 Module implementing a dialog showing a pixmap. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import Qt, QSize |
10 from PyQt4.QtCore import Qt, QSize, QEvent |
11 from PyQt4.QtGui import QMainWindow, QLabel, QPalette, QSizePolicy, QScrollArea, \ |
11 from PyQt4.QtGui import QMainWindow, QLabel, QPalette, QSizePolicy, QScrollArea, \ |
12 QAction, QMenu, QToolBar, QImage, QPixmap, QDialog, QPrinter, QPrintDialog, \ |
12 QAction, QMenu, QToolBar, QImage, QPixmap, QDialog, QPrinter, QPrintDialog, \ |
13 QPainter, QFont, QColor |
13 QPainter, QFont, QColor |
14 |
14 |
15 from E5Gui import E5MessageBox |
15 from E5Gui import E5MessageBox |
198 self.__zoomIn() |
200 self.__zoomIn() |
199 evt.accept() |
201 evt.accept() |
200 return |
202 return |
201 |
203 |
202 super().wheelEvent(evt) |
204 super().wheelEvent(evt) |
|
205 |
|
206 def event(self, evt): |
|
207 """ |
|
208 Protected method handling events. |
|
209 |
|
210 @param evt reference to the event (QEvent) |
|
211 @return flag indicating, if the event was handled (boolean) |
|
212 """ |
|
213 if evt.type() == QEvent.Gesture: |
|
214 self.gestureEvent(evt) |
|
215 return True |
|
216 |
|
217 return super().event(evt) |
|
218 |
|
219 def gestureEvent(self, evt): |
|
220 """ |
|
221 Protected method handling gesture events. |
|
222 |
|
223 @param evt reference to the gesture event (QGestureEvent |
|
224 """ |
|
225 pinch = evt.gesture(Qt.PinchGesture) |
|
226 if pinch: |
|
227 if pinch.state() == Qt.GestureStarted: |
|
228 pinch.setScaleFactor(self.zoom) |
|
229 else: |
|
230 self.__doZoom(pinch.scaleFactor() / self.zoom) |
|
231 evt.accept() |
203 |
232 |
204 ############################################################################ |
233 ############################################################################ |
205 ## Private menu handling methods below. |
234 ## Private menu handling methods below. |
206 ############################################################################ |
235 ############################################################################ |
207 |
236 |