Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Emitting initial signals/Application setup
eddyilg last edited by
I am wondering if there is a good way to trigger signals (like "toggle", "change", "update", ...) from other objects during initialization.
I am always getting the states of other objects by hand and setting them in the current class. Later on they are modified by signals. I am wondering if this "handwork" of getting the objects into a synchroniyzed initial state can be reduced somehow.
Sometimes I imagine an initialization stage after the objects are created where all signals are fired once.
What are your approaches?
andre last edited by
My approach for this kind of thing usually is, to have a single slot updateGui() or something like that. All signals that can result in an update of the Gui connect to that slot. In that slot, I put all the logic of updating the different Gui elements according to the relevant states (checked checkboxes, radiobuttons, selected items from combo boxes, etc. etc.).
At the end of my constructor method, I simply call this method once to initialize the Gui state.