Pyqt 5 如何使 QLineEdit 可点击 [英] Pyqt 5 how to make QLineEdit clickable

查看:115
本文介绍了Pyqt 5 如何使 QLineEdit 可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道如何使 QLineEdit 可点击,因为我想在点击 QLineEdit 时清除该行的文本.

I just wonder how to make a QLineEdit clickable because I want when the QLineEdit is clicked to clear the line's text.

推荐答案

尝试下面的代码使 QLineEdit 可点击:

Try Below Code to make QLineEdit clickable :

class ClickableLabel(QLabel):

    clicked = pyqtSignal()
    def __init__(self,name, widget):
        super().__init__(name, widget)
    def mousePressEvent(self, QMouseEvent):
        self.clicked.emit()

这篇关于Pyqt 5 如何使 QLineEdit 可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆