Important: Please read the Qt Code of Conduct -

[resolved] Extending classes and UI considerations

  • Hello,

    I'm new to C++ and to the fabulous universe of Qt.
    For my first project, I'd like to write a class that extends QDialog. I'll then like to extend my own class.
    (Let's say, the main class is "Game", and each minigame extends it.)

    I don't know how to handle UIs. Actually, I'd like both classes ("Game" and "MiniGame1") to be able to access the same UI.

    IE : evey game will have a Timer and a ProgressBar attached (countdown), my Game class should update the bar, but I'd like each game to have a different starting value)

    (in PHP, the syntax would be something like parent::UI)

    Any hints will be appreciated. Thank you for your time !

  • I found a solution :

    • I create the layout in the "parent" class as protected,
    • I don't create anything in the "child", and I can access it :)

    Thank you ! :)

Log in to reply