-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtrackinglabel.py
More file actions
21 lines (17 loc) · 834 Bytes
/
Copy pathtrackinglabel.py
File metadata and controls
21 lines (17 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from PyQt5.QtWidgets import QLabel
from PyQt5 import QtGui, QtCore
class TrackingLabel(QLabel):
label_click_signal = QtCore.pyqtSignal(int, int, int)
def __init__(self, parent=None):
super().__init__(parent)
def mousePressEvent(self, ev: QtGui.QMouseEvent):
if self.objectName() == 'img_11':
if ev.button() == QtCore.Qt.LeftButton:
self.label_click_signal.emit(1, ev.x(), ev.y())
if ev.button() == QtCore.Qt.RightButton:
self.label_click_signal.emit(2, ev.x(), ev.y())
elif self.objectName() == 'img_21':
if ev.button() == QtCore.Qt.LeftButton:
self.label_click_signal.emit(3, ev.x(), ev.y())
if ev.button() == QtCore.Qt.RightButton:
self.label_click_signal.emit(4, ev.x(), ev.y())