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

Ryan Hanson crossrocker at gmail.com
Mon Mar 25 20:24:05 GMT 2013


On Mon, Mar 25, 2013 at 3:05 PM, Baz Walter <bazwal at ftml.net> wrote:

> 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
>
> ______________________________**_________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.**com/mailman/listinfo/py<http://www.riverbankcomputing.com/mailman/listinfo/pyqt>




I enable saving after a line is modified but I have 5 lines that can be
modified, that is originally why I did the isModified check. I suppose I
don't really need to save individuals values. I will switch to saving the
whole record.

Thanks for clearing it up what it was doing for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130325/9315a7a4/attachment.html>


More information about the PyQt mailing list