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

QWidget should allow having multiple layouts in it

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P5: Not important
    • None
    • 5.3.0 Beta1
    • Widgets: Layout
    • None

    Description

      Adding the second layout to QWidget causes this message:
      QLayout: Attempting to add QLayout "" to QGroupBox "", which already has a layout

      In principle, widgets should allow multiple layouts. Some child widgets can be managed by one layout, and some other child widgets — by some other layout. There is nothing wrong with such disposition. Child widgets (siblings) may overlap in such case, but this is up to the user to set their Z order and design such layout properly. This is certainly not for a mainstream dialog design, but can add a lot of flexibility to some particular cases.

      layout() will return the first (or only) layout, and layouts() will return the list of layouts.

      Particular application which led to this suggestion:
      I tried to add some extra "floating" widget in the corner of otherwise "normal" QVBoxLayout managed dialog. QBoxLayout with Qt::AlignRight|Qt::AlignTop would have achieved this, but an additional layout can't be added.

      Currently, it is possible to solve this problem using QStackedLayout and setting transparent background of one of the widgets, but this is more convoluted.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            smd Jan Arve
            yurivict Yuri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes