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

Initial size of widget in splitter



  • Hi,

    Given a vertical splitter with two widgets in it, how do I set the initial height of the top widget to a certain value. The bottom widget should occupy the rest of the space.

    I want to do this in Qt creator so I can see the form I create.

    W.



  • I didn't find this option for splitters in QtCreator. But in code you can use "setStretchFactor()":http://qt-project.org/doc/qt-5.0/qtwidgets/qsplitter.html#setStretchFactor



  • QtDesigner is probably what you mend? No such option I'm afraid. Have been searching for it as well. Didn't find it.



  • We can set the stretch factor of the widgets in the splitter, but this hardly doesn't seem to make any difference. See my question at http://qt-project.org/forums/viewthread/26584/. No mather what policy or size values I set, the widgets/splitter does behave very odd. Maybe it's a bug.



  • I remember that I also fought against such strange situations ...
    I never found some really nice solution to it ...

    I could only remember that the "sizeHint()" plays an important role in layouting, which on the other hand can't be modified by properties ... so, I had to subclass some things just to fix layouting °° (or using fixed sizes)
    Especially this was the case with QListView/QTreeView which had a really strange default implementation of sizeHint() ... probably some similar is/was in GraphicsView ....


Log in to reply