How to insert a button inside a QLineEdit
问题 I need help inserting a button inside in a QLineEdit that can call a function. For example, like this google image: 回答1: Below is a nearly direct translation of the Qt code from here. Differences: button is always visible clicking on the button emits buttonClicked(bool) signal Code: from PyQt4 import QtGui, QtCore class ButtonLineEdit(QtGui.QLineEdit): buttonClicked = QtCore.pyqtSignal(bool) def __init__(self, icon_file, parent=None): super(ButtonLineEdit, self).__init__(parent) self.button =