Important: Please read the Qt Code of Conduct -

Making a qttreeview resize with the qdialog

  • Hi All,
    went back to working on some old code. On one dialog I have a single treeview. However try as I might I can't get the tree to expand with the dialog. I also have several other dialogs in the software with treeviews and these work fine. The only difference I can see is in the expanding ones "geometry" is greyed out on the treeview. But I can't workout what I've done to achieve this.
    Can anyone advise what I need to do to get this to work? Thanks

  • Lifetime Qt Champion

    Since geometry is grey out, it sounds like you used a layout for the working ones.
    If the one not working has free/non grey "geometry ", its not in layout
    and that is the reason.

    Normally, a layout is all that is needed. (to follow parent)

    To make one that follow, its simply
    Create a new Dialog with UI.
    Click on UI file
    Drag TreeView to Dialog UI
    Right click somewhere on Dialog UI
    Select Layout -> Layout vertically
    Then TreeView should follow.

  • @mrjj Thankyou it was layout. I searched every parameter but didn't notice that had a no entry sign

Log in to reply