pyqt-todolist/view/LineEdit.py

25 lines
793 B
Python
Raw Permalink Normal View History

2022-04-14 21:22:47 +08:00
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import *
class LineEdit(QLineEdit):
clicked = pyqtSignal()
def __init__(self):
super(LineEdit, self).__init__()
# layout = QHBoxLayout()
# self.setLayout(layout)
# icon = QPixmap('../images/circle.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
# icon_label = QLabel()
# icon_label.setPixmap(icon)
# icon_label.setMaximumSize(30, 30)
# icon_label.setScaledContents(True)
# layout.addWidget(icon_label)
def mousePressEvent(self, QMouseEvent):
# print('click left button')
if QMouseEvent.button() == Qt.LeftButton:
# self.setEnabled(False)
self.clicked.emit()