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

GraphicsGridLayout: minimumSize not honored when using rowSpan

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 4.7.4, 5.3.2
    • Fix Version/s: None
    • Component/s: Widgets: GraphicsView
    • Environment:
      Windows XP SP3
      Qt SDK with Qt Creator 2.4.1, Qt 4.7.4

      Description

      When using row spans in a QGraphicsGridLayout, the minimum size of an item is not honored, although sufficient room would be available.

      Code snip:

      pWidgetTopLeft->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding));
      pWidgetTopLeft->setMinimumSize(QSizeF(150,360));
      pWidgetTopLeft->setPreferredSize(QSizeF(150,360));
      m_pMainLayout->addItem(pWidgetTopLeft,
      0,0,2,1);

      pWidgetBottomLeft->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred));
      pWidgetBottomLeft->setMinimumSize(QSizeF(60,20));
      pWidgetBottomLeft->setPreferredSize(QSizeF(60,20));
      m_pMainLayout->addItem(pWidgetBottomLeft,
      2,0);

      pWidgetTopRight->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
      pWidgetTopRight->setMinimumSize(QSizeF(0,0));
      pWidgetTopRight->setPreferredSize(QSizeF(50,50));
      m_pMainLayout->addItem(pWidgetTopRight,
      0,1);

      pWidgetBottomRight->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum));
      pWidgetBottomRight->setMinimumSize(QSizeF(40, 50));
      pWidgetBottomRight->setPreferredSize(QSizeF(40, 50));
      m_pMainLayout->addItem(pWidgetBottomRight,
      1,1,2,1);

      Also see attached screenshot.

      pWidgetBottomLeft has a row span of 1, whereas pWidgetBottomRight has a row span of 2. Nevertheless, they occupy the same height, and the height is less than the minimum height of pWidgetBottomRight.

      See also attached complete sample project.

        Attachments

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

          Activity

            People

            Assignee:
            smd Jan Arve
            Reporter:
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes