Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Top alignment of items



  • i have a QTabWidget and in a tab i created a QGroupBox in which i have placed a QGridLayout into which i have placed 3 rows in the first column then i added a vertical spacer (QSpacerItem) in the fourth row hoping this spacer would take up all the vertical spacing and push all the items to the top of the group box but no matter what i have tried i cannot remove a space appearing at the top.

    i have tried setContentsMargins, setSpacing, etc. to no effect.

    !http://i.imgur.com/2eYGphG.png()!

    notice the spacing above the first button (New) i wan to remove this spacing.

    thanks



  • nevermind, i found that if i used the following style sheet then it gives me the behavior i desired.

           "QGroupBox {margin-top : 0px;}\n"
    

Log in to reply