<div dir="ltr">I am writing a program to interact with a database and one of my pages I allow the users to modify the values using QlineEdits. They when the user saves I check isModified so I know which values to save. It works as expected on most of the lines but a have one that uses a QCompleter and isModified returns false if the user picks off the list. <div>

<br></div><div style>Is there a way around this? If not any suggestions on how I should check if the item has been modified?</div><div style><br></div><div style>I have some sample code showing my problem. </div><div style>

<br></div><div style><code></div><div style><div>import sys</div><div>from PyQt4 import QtCore, QtGui </div><div><br></div><div>class Ui_Form(QtGui.QWidget):</div><div>    def __init__(self, parent=None):</div><div>

        QtGui.QWidget.__init__(self, parent)</div><div>        self.setObjectName("Form")</div><div>        self.resize(138, 73)</div><div>        self.verticalLayout = QtGui.QVBoxLayout(self)</div><div>        self.verticalLayout.setObjectName("verticalLayout")</div>

<div>        self.lineEdit = QtGui.QLineEdit(self)</div><div>        self.lineEdit.setObjectName("lineEdit")</div><div>        self.verticalLayout.addWidget(self.lineEdit)</div><div>        self.pushButton = QtGui.QPushButton(self)</div>

<div>        self.pushButton.setObjectName("pushButton")</div><div>        self.verticalLayout.addWidget(self.pushButton)</div><div>        self.comp = QtGui.QCompleter(['1','2','3','4','5'])</div>

<div>        self.lineEdit.setCompleter(self.comp)</div><div>        self.pushButton.clicked.connect(self.modified)</div><div>        self.lineEdit.textChanged.connect(self.textMod)</div><div>        </div><div>    def modified(self):</div>

<div>        print self.lineEdit.isModified()</div><div>        </div><div>if __name__ == "__main__":</div><div>    app = QtGui.QApplication(sys.argv)</div><div>    myapp = Ui_Form()</div><div>    myapp.show()</div>

<div>    sys.exit(app.exec_())</div><div style></code></div></div></div>