7 Module implementing a base class for showing a document map. |
7 Module implementing a base class for showing a document map. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import Qt, QSize, QRect, QCoreApplication, qVersion |
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 |
15 |
17 |
16 |
18 |
17 class E5MapWidget(QWidget): |
19 class E5MapWidget(QWidget): |
18 """ |
20 """ |
19 Class implementing a base class for showing a document map. |
21 Class implementing a base class for showing a document map. |
217 """ |
219 """ |
218 Protected slot handling mouse wheel events. |
220 Protected slot handling mouse wheel events. |
219 |
221 |
220 @param event reference to the wheel event (QWheelEvent) |
222 @param event reference to the wheel event (QWheelEvent) |
221 """ |
223 """ |
222 if qVersion() >= "5.0.0": |
224 if qVersionTuple() >= (5, 0, 0): |
223 isVertical = event.angleDelta().x() == 0 |
225 isVertical = event.angleDelta().x() == 0 |
224 else: |
226 else: |
225 isVertical = event.orientation() == Qt.Vertical |
227 isVertical = event.orientation() == Qt.Vertical |
226 if self._master and \ |
228 if self._master and \ |
227 event.modifiers() == Qt.NoModifier and \ |
229 event.modifiers() == Qt.NoModifier and \ |