16 class E5ClickableLabel(QLabel): |
16 class E5ClickableLabel(QLabel): |
17 """ |
17 """ |
18 Class implementing a clickable label. |
18 Class implementing a clickable label. |
19 |
19 |
20 @signal clicked(QPoint) emitted upon a click on the label |
20 @signal clicked(QPoint) emitted upon a click on the label |
21 with the left buton |
21 with the left button |
22 @signal middleClicked(QPoint) emitted upon a click on the label |
22 @signal middleClicked(QPoint) emitted upon a click on the label |
23 with the middle buton or CTRL and left button |
23 with the middle button or CTRL and left button |
24 """ |
24 """ |
25 clicked = pyqtSignal(QPoint) |
25 clicked = pyqtSignal(QPoint) |
26 middleClicked = pyqtSignal(QPoint) |
26 middleClicked = pyqtSignal(QPoint) |
27 |
27 |
28 def __init__(self, parent=None): |
28 def __init__(self, parent=None): |
42 if evt.button() == Qt.LeftButton and self.rect().contains(evt.pos()): |
42 if evt.button() == Qt.LeftButton and self.rect().contains(evt.pos()): |
43 if evt.modifiers() == Qt.ControlModifier: |
43 if evt.modifiers() == Qt.ControlModifier: |
44 self.middleClicked.emit(evt.globalPos()) |
44 self.middleClicked.emit(evt.globalPos()) |
45 else: |
45 else: |
46 self.clicked.emit(evt.globalPos()) |
46 self.clicked.emit(evt.globalPos()) |
47 elif evt.button() == Qt.MiddleButton and \ |
47 elif evt.button() == Qt.MidButton and \ |
48 self.rect().contains(evt.pos()): |
48 self.rect().contains(evt.pos()): |
49 self.middleClicked.emit(evt.globalPos()) |
49 self.middleClicked.emit(evt.globalPos()) |
50 else: |
50 else: |
51 super(E5ClickableLabel, self).mouseReleaseEvent(evt) |
51 super(E5ClickableLabel, self).mouseReleaseEvent(evt) |