[Interest] QWindowSystemInterface::flushWindowSystemEvents() causes signals to be handled in the wrong order?
rene.reucher at batcom-it.net
Wed Aug 7 10:37:41 CEST 2013
On Wednesday 07 August 2013 10:19:34 Michel Rosien wrote:
> In my application a QWidget can be created/destroyed using a toggle button.
> If the button is pressed rapidly, so many 'on' - 'off' - 'on' - 'off'
> signals are being send, it can occur that an 'on' signal is handled while
> an 'off' handler is still in progress (because the 'off' handler deletes
> the widget)
> Am I forced to use deleteLater instead of delete for a QWidget in this
> case? I would like to prevent this.
> Any thoughts?
It sounds as if there can only be one instance of this QWidget at a time... so
why not keep a pointer to it, initialized to NULL / set to NULL after
deletion, so your on/off handlers could check that before acting (delete only
if *not* NULL / create only *if* NULL).
More information about the Interest