I have a small Qt plotting application and I am enabling/disabling widgets (combo/spin boxes) based on a "master" combo box. For example, say the master is combo1
, which changes the entries in combo2
, based on currentIndex()
, enables/disables spin1
, and sets a value for spin1
if a certain entry in combo1
is selected. There are more widgets than only these, though.
After the small discussion in the chat (and onwards), I used Qt::QueuedConnection
with every connect()
, but this didn't stop the re-enabled widgets to emit signals when re-enabled. This caused my many connect()
to all be executed for all the re-enabled widgets, resulting in multiple plottings, which I want to avoid. As they are right now, (almost) all the widgets use plot()
inside a connect()
, so it's multiple signals to one slot.
My question: is there a way to prevent emitting the signals when the widgets are re-enabled? I could make plot()
use some bool
to check whether the plot has been executed and prevent further actions of the same type, but that would still cause the widgets to emit the signal and run plot()
, even if the check will prevent the actual plotting, but that doesn't seem like the way to go. I would also prefer to avoid running installEventFilter()
, or similar, as that would, most probably, slow down even more than the previous fix.