Qt World Summit: Register Today!

[SOLVED] Qt approaches for multi-module type app

  • Hi, I'm coming back to Qt after being away for a while. Lots of great improvements! I've mainly been involved with Flex/Actionscript development but have worked with C++ and tinkered with Qt enough to teach myself and learn the basics. One area that is harder to get a handle on is using what Qt provides to advantage in architecting more complex applications.

    For example: say I wanted to develop a "game pack" app for kids with

    • Shell
      • checkers
      • chess
      • connect4
      • etc

    and the user can switch between modules and they retain state (which can be serialized and restored, etc.)

    I know how I would approach this in Flex (where there is a "module" concept) but am confused about the most efficient/flexible way to do this in Qt. And to complicate things a bit more. . . perhaps I want to be able to have multiple instances of a chess game, or want to release new "modules" for the user to download at a later date.

    I've seen "StackView" for QML. Are there other schemas or mechanisms Qt provides for this sort of application? Just looking for ideas and things to look into in what Qt provides.


  • Lifetime Qt Champion


    Do you mean something like an app chooser ? Or would your modules be plugins for a central application ?

  • @SGaist said:

    Do you mean something like an app chooser ? Or would your modules be plugins for a central application ?

    It would be the latter: the "modules" (or plugins) would not be able to run outside of the "shell" app, and the user could switch back and forth between the individual modules. Each module takes up the full application window. In Flex there is a concept of "containers" for various purposes – the ViewStack being one. From the Flex docs:

    A ViewStack navigator container is made up of a collection of child containers that are stacked on top of each other, with only one container visible, or active, at a time.

    The "StackView" for QML seems similar but I thought I would ask here if there are other/better ways built into Qt to handle this sort of navigation

  • The QStackedWidget class provides a stack of widgets where only one widget is visible at a time.

  • Lifetime Qt Champion

    The StackView is a good fit for this, you can go with it.

  • OK, thanks.

Log in to reply