Clear QLineEdit on click event

前端 未结 3 1486
暗喜
暗喜 2020-11-28 16:07

I am using the given code, I want the user to enter text in the QLineEdit widget, press the Copy! button and see the inputted text replace the \'N/A\' label. My questions is

3条回答
  •  無奈伤痛
    2020-11-28 16:43

    I have an optional solution in one line:

    self.lineEdit.mouseReleaseEvent = self.copy_and_print
    

    Make sure you are receiving two parameters in your function (self,event) I hope I helped you

    Full post: https://wiki.python.org/moin/PyQt/Making%20non-clickable%20widgets%20clickable

提交回复
热议问题