I'm trying to implement simple tabbed interface with Qt5. I use QTabWidget with QToolBars placed inside its tabs and I add QActions to the QToolBars:
The toolbar and the widget below are within a vertical layout. I'd like toolbars to autosize their height to be just enough high to hold QToolButtons inside (the last ones can display icon, text or both of them (text under icon or on the right side of it), that affects their height) and autosize their width to display as many toolbuttons, as fits into parent tab width. Also I'd like parent tabs to automaticaly stretch or shrink their height to be able to display the toolbars within. Is that possible in Qt? If yes, then how?
UPDATE1: Horizontal autostretching has been already done by using toolbars as tab widgets of QTabWidget. But vertical one is still missing. Significant code (for QDesigner):
<widget class="QWidget" name="central_widget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabbed_tool_bar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QToolBar" name="tool_tab_game">
<property name="windowTitle">
<string>Game ToolTab</string>
</property>
<attribute name="title">
<string>&Game</string>
</attribute>
…
</widget>
<widget class="QToolBar" name="tool_tab_movement">
<property name="windowTitle">
<string>Movement ToolTab</string>
</property>
<attribute name="title">
<string>&Movement</string>
</attribute>
…
</widget>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scroll_area">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
…
</widget>
</item>
</layout>
</widget>
Currently when the window is resized vertically, then the tab widget is also resized vertically. But I want it to resize only depending on contained toolbars' height, and to keep its height when the parent window is resized.
UPDATE2: Expected vertical autoresizing is done via setting QTabWidget vertical sizepolicy to Fixed and QScrollArea below vertical size policy to Expanding. UI XML listed above is modified accordingly now.