Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QToolBox Resizing issues
I have a toolbox with multiple tabs. Within each region there are editable fields. After so many tabs are added that area turns into a scrollable area instead of simply resizing itself. So my question is, is there a way to set the size of the contained frame so that no matter how much i add the ToolBox widget items never get smaller. that way when i expand and area everything contained within that area is visible? I am starting to think this is a limitation with QToolBox.
Guest last edited by
if I got you right, you want the frame that contains the toolbox to expand as you keep adding more toolbox widget items.
does the frame have the right size policy? does the container of the frame and its layout allow it to resize? at some point you will hit the application's mainwindow size limit, how do you propose to handle it then?
No I use a scroll area for that, i need to be able to have a set size within the toolbox viewing area as i add new tabs to it. The more tabs you add the more in compresses the viewing area of the active tab. I need that viewing area to stay a fixed size. I have not been able to find anything in the documentation that suggests this is possible which is why I am asking.
Guest last edited by
You can have a custom page (with a fixed custom size) and a fixed size policy add it to each of the tabs in the toolbox. Then add your widgets to the custom pages under each tab...
I just tried and it works. The toolbox had a preferred size policy was enclosed in a scrollarea (expanding size policy)
Ok thank you. I figured I would have to do something similar to that, but before i did i wanted to make sure there was not an implicit way of doing it.
nickjwallin last edited by
In case anybody stumbles upon this, I found that to set the minimum size of the tab, you can hack it a bit by setting the minimum height of the grandparent (parent's parent) widget of the widget you insert/add to the QToolBox. Basically, like this:
@CustomWidget* custom = new CustomWidget();
toolBox->insertItem(0, custom, "Tab Title");
custom->setParentMinimumHeight(400); // 400 is an example@
Where CustomWidget::setParentMinimumHeight(int) is something like:
@void CustomWidget::setParentMinimumHeight(int height)
QWidget* parent = this->parentWidget();
QWidget* gparent = parent->parentWidget();