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

How can I control the height of each widget in QToolBox



  • I want to control the QToolBox could be resized adaptively based on each widget I add into.
    e.g. the first item(widget) just has two buttons, so when the first tab is clicked, the first item should be showed in actual size( two buttons' size ) not the expanding size. On the other hand, when one item has so many buttons, it also should be showed in actual size( so many buttons' size ) not the expanding size with a scroll bar.
    So what should I do?


  • Lifetime Qt Champion

    Hi
    You would have to calculate its new size manually i think.
    Any layouts on the actual pages would not know that there can be several other page captions
    that should also count towards the total height.

    You could also make your own class that can do this.
    the toolbox is fairly small
    https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qtoolbox.h.html


Log in to reply