Qt--自定义LineEdit实现点击信号

from PyQt5 import QtCore
from PyQt5.QtWidgets import QLineEdit

class MyLineEdit(QLineEdit):
  click = QtCore.pyqtSingal()  #自定义点击触发信号
  enter = QtCore.pyqtSingal()  #自定义鼠标移入则触发信号
  def __init__(self,parent=None):
    super(MyLineEdit,self).__init__(parent)

  def mousePressEvent(self,MouseEvent):
    self.clicked.emit()

  def enterEvent(self):
    self.enter.emit()
posted @ 2022-03-25 15:22  tingshu  阅读(960)  评论(0)    收藏  举报