Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.4.0, 6.4.2
-
None
Description
When there is not enough space in the toolbar for all buttons some of them disappear and the extension button appears on the right side. Sometimes when the extension button appears the widest button becomes smaller and the text inside can be clipped.
The easy scenario to reproduce the bug is to have a toolbar with one button containing a long label and several smaller buttons with the approximately same width.
On the image, you can see a toolbar at the top. Below the toolbar is the button with the width corresponding to the width of the extension button. It is used just to visualize the problem.
If to drag the side of the window with the mouse to decrease the width then expected that buttons 5, 6, 7, and 8 will disappear and the extension button will take their place.
Instead of that, the biggest button gets smaller and its text becomes clipped and buttons 5, and 6 are still visible.
The problem appears to be in QToolBarLayout::layoutActions() function. In this line if there is not enough space for the extension button the previous item (which is the button "7") in the layout becomes an expansive empty item. So buttons "7" and "8" disappear but there is still not enough space for the expensive button and deficit space is subtracted from the widest button.
So in fact, it's needed to go further back to find out how many buttons should be hidden instead of relying on the idea that hiding one item will be enough.