Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110683

QToolBar: extension button breaks layout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.0, 6.4.2
    • Widgets: Layout
    • None
    • Windows

    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. 

      Attachments

        1. image-2023-01-26-18-59-40-765.png
          4 kB
          Vitaly
        2. image-2023-01-26-19-06-07-167.png
          5 kB
          Vitaly
        3. QToolBarBug.7z
          2 kB
          Vitaly
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            medyakovvit Vitaly
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes