[Interest] QLIneEdit Bug still valid ?

André Somers andre at familiesomers.nl
Thu Jul 19 12:02:21 CEST 2012


Op 19-7-2012 11:54, Bo Thorsen schreef:
> Den 17-07-2012 10:22, André Somers skrev:
>> Op 17-7-2012 9:45, Tony Rietwyk schreef:
>>>> Hi,
>>>>
>>>> A much easier solution to disconnecting the signals, is to set a flag before calling setText, then check that in the slot.
>>>>
>>>> Hope that helps,
>>>>
>>>> Tony
>>>>
>> Or use QObject::blockSignals(true) on the line edit before you set the
>> text, and the same with false afterwards.
> Ah, you just hit one of my pet peeves :) When doing stuff like this,
> create a class for it. Simpler to reuse and exception safe. For this
> exact problem (blockSignals) I have the code on my blog:
>
> http://www.fioniasoftware.dk/blog/?p=158
>
> The code is trivial. But getting the habit of using objects for this
> kind of problem is pretty important.
>
> Bo Thorsen,
> Fionia Software.
>
That's exactly what I do for these kinds of things, though there are 
many more of these pairs to be found in Qt that would benefit of a RAII 
class. Setting the bussy cursor and SQL transactions are just two of 
them, next to blocking signals of course...

André





More information about the Interest mailing list