Important: Please read the Qt Code of Conduct -

Hide and show group at runtime

  • Not sure how to even start on this. I have a group of widgets and I want to 'instantiate' the group on the form via a menu command. Also need to be able to remove the group with a delete key.

    Is this even possible?

  • Lifetime Qt Champion


    Do you mean create a new "group" each time or just show/hide that group ?

  • Not sure. (I pretty much a newbie)

    I'll have various groups that are pre-defined as far as what widgets are in them and how they're laid out.

    The end user needs to be able to place the group fill in blanks and/or select items in combo boxes, etc.

    If the end user then decides to delete the group it's gone and only an 'undo' can retrieve it.

    If the 'place' the group again via the menu it is a new group with default settings.

    I suppose an example of what I am trying to do might be the way qt designer works with it's widget placement on a form.

    Hope that clear.

  • Lifetime Qt Champion

    Then you should make a separate widget for each group, it will simplify the handling.

    For the undo part, have a look at QUndoStack

    For the layout part, it seems you will do it vertically, so you can use a QVBoxLayout

    Hope it helps

Log in to reply