Painting in a QLabel with paintEvent
问题 I want to paint a rectangle in a certain label, I made a GUI with QtDesigner that generates the whole GUI code in one class called "class Ui_MainWindow(QMainWindow):" and I am using three tabs in my window. I had a problem using the QMouseEvent on my labels, I found a solution using this code from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import Qt import sys import cv2 from PyQt5.QtWidgets import QMainWindow, QWidget, QLabel from PyQt5.QtGui import QPixmap, QImage class Ui