Important: Please read the Qt Code of Conduct -

Best approach to for a dock widget registry?

  • Does anyone have a suggestion for a 'dock widget registry'? While I could do this myself, I first wanted to find out whether there was anything offered by Qt or a commonly used class implementation?

    As background: I am currently dealing with an application where all the dock widgets are hard coded into the main window, with calls to each of them made explicitly. I would like to evolve the application such the dock widgets are added to a registry and then at each phase of the lifecycle calls made to the entries, based on the interfaces they implement. The idea is that this would make it easier to add a new dock widget as needed, without needing to modify code in n different places.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What do you mean by "calls to each of them" ? Are you calling one dock widget function insider another dock ? If so the first step would be to use signals and slots to avoid that.

  • The code currently has a main window that creates and instance of each dock widget and then for each will make a call to each specific widget, based on the action. I'll look at the signals and slots for the the message passing and see if that reduces the need for a registry.

  • Lifetime Qt Champion

    @ajmas said:
    Can you say a little about what this registry would do?

  • The idea would be a place to 'register' all the dock widgets the available to the application and then access them based on functionality.

    I ended up just using a list and cycling through the entries. It is not as sophisticated, but it actually fills the need, especially for the current small number, rather than over-engineering the problem. If the need changes down the road, then I'll re-evaluate at that point. - Thanks

    I can probably mark this question as solved.

Log in to reply