10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import Qt, QSize, QRect, QCoreApplication |
12 from PyQt5.QtCore import Qt, QSize, QRect, QCoreApplication |
13 from PyQt5.QtGui import QColor, QBrush, QPainter |
13 from PyQt5.QtGui import QColor, QBrush, QPainter |
14 from PyQt5.QtWidgets import QWidget, QAbstractScrollArea |
14 from PyQt5.QtWidgets import QWidget, QAbstractScrollArea |
15 |
|
16 from Globals import qVersionTuple |
|
17 |
15 |
18 |
16 |
19 class E5MapWidget(QWidget): |
17 class E5MapWidget(QWidget): |
20 """ |
18 """ |
21 Class implementing a base class for showing a document map. |
19 Class implementing a base class for showing a document map. |
249 """ |
247 """ |
250 Protected slot handling mouse wheel events. |
248 Protected slot handling mouse wheel events. |
251 |
249 |
252 @param event reference to the wheel event (QWheelEvent) |
250 @param event reference to the wheel event (QWheelEvent) |
253 """ |
251 """ |
254 if qVersionTuple() >= (5, 0, 0): |
252 isVertical = event.angleDelta().x() == 0 |
255 isVertical = event.angleDelta().x() == 0 |
|
256 else: |
|
257 isVertical = event.orientation() == Qt.Vertical |
|
258 if self._master and \ |
253 if self._master and \ |
259 event.modifiers() == Qt.NoModifier and \ |
254 event.modifiers() == Qt.NoModifier and \ |
260 isVertical: |
255 isVertical: |
261 QCoreApplication.sendEvent(self._master.verticalScrollBar(), event) |
256 QCoreApplication.sendEvent(self._master.verticalScrollBar(), event) |
262 |
257 |