[Interest] QLIneEdit Bug still valid ?

Tony Rietwyk tony at rightsoft.com.au
Thu Jul 19 15:51:38 CEST 2012


Andre said

> Sent: Tuesday, 17 July 2012 6:22 PM
> 
> 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. Seems easier to manage than another
> boolean flag somewhere, because it stays local to the place where you do
> the actual invokation. The flag would need code at three
> places: around the invokation, in the header as a member variable, and in
the
> slot implementation when it is checked.
> 
> André

Hi André, 

I don't use blockSignals because the side effects are undocumented.  The
problem is that ALL signals are blocked, not just the specific call to your
slot.  Lots of things rely on the changed signal from QLineEdit - attached
models and complex widgets, like QComboBox, for example.  Also, from reading
the Qt code in general, there is often a complex web of internal signals
between the public and private interfaces, and I've always assumed they are
affected as well (?).  

Tony





More information about the Interest mailing list