Important: Please read the Qt Code of Conduct -

Emitting initial signals/Application setup

  • Hi,

    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?

    Best regards,


  • 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.

Log in to reply