How to get Click Event of QLineEdit in Qt ?
I am not able to see any SLOT related to click in QLineEdit ?
How to get Click Event of QLineEdit in Qt ?
I am not able to see any SLOT related to click in QLineEdit ?
I used this solution many times
def clickable(widget): # make this function global
class Filter(QObject):
clicked = pyqtSignal()
def eventFilter(self, obj, event):
if obj == widget and event.type() == QEvent.MouseButtonRelease and obj.rect().contains(event.pos()):
self.clicked.emit()
return True
else:
return False
filter = Filter(widget)
widget.installEventFilter(filter)
return filter.clicked
clickable(self.lineedit).connect(self.test) #use this in class
def test(self):
print("lineedit pressed")
pass
Just use the Pushbutton clicked event. Change the backcolor of the Pushbutton into Transparent then remove the text of it. Lay it in front of the LineEdit then use the setfocus property of the LineEdit when the push button was clicked. That's the easiest way to get the clicked event and use it in LineEdit..