[PyQt] Can't QLineEdit.isModified with QCompleter?

Baz Walter bazwal at ftml.net
Mon Mar 25 20:05:29 GMT 2013


On 25/03/13 13:41, Ryan Hanson wrote:
> 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.
>
> Is there a way around this? If not any suggestions on how I should check if
> the item has been modified?

The completer calls setText(), which will always reset the modification 
state to False.

You could disable the save button by default, and then connect the 
textChanged signal of all the line-edits to a handler which re-enables 
the save button as appropriate.

But it's also worth asking whether you *really* need to check whether 
each individual value has changed. Why not just save them all whenever 
the user chooses to save?

-- 
Regards
Baz Walter



More information about the PyQt mailing list