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

QGraphicsGridLayout span error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 4.8.4, 5.0.1
    • Widgets: GraphicsView
    • None
    • Windows 7
    • 4f072e2d3d7e429359ff15a615d02712bff7ee51 1112b5ca9b448ce26cdd9eb7cc67abc7f9d537d8 a077d075eafa947b48cf0824146d8dc6873b10ed

    Description

      QGraphicsGridLayout does not layout spanned items correctly. The code below should result the layout shown in the correctLayout.png. Instead it lays out the items so that they are on top of each other as shown in the incorrectLayout.png.

          QGraphicsScene scene;
          QGroupBox g1, g2, g3, g4, g5, g6, g7;
          QGraphicsWidget *gw1 = scene.addWidget(&g1);
          QGraphicsWidget *gw2 = scene.addWidget(&g2);
          QGraphicsWidget *gw3 = scene.addWidget(&g3);
          QGraphicsWidget *gw4 = scene.addWidget(&g4);
          QGraphicsWidget *gw5 = scene.addWidget(&g5);
          QGraphicsWidget *gw6 = scene.addWidget(&g6);
          QGraphicsWidget *gw7 = scene.addWidget(&g7);
      
          QGraphicsGridLayout *glayout = new QGraphicsGridLayout;
          glayout->addItem(gw1, 0, 0, 1, 1);
          glayout->addItem(gw2, 0, 1, 1, 2);
          glayout->addItem(gw3, 0, 3, 1, 1);
      
          glayout->addItem(gw4, 1, 0, 1, 4);
      
          glayout->addItem(gw5, 2, 0, 1, 1);
          glayout->addItem(gw6, 2, 1, 1, 2);
          glayout->addItem(gw7, 2, 3, 1, 1);
      
          QGraphicsWidget* form = new QGraphicsWidget;
          form->setLayout(glayout);
          form->setMinimumWidth(500);
          form->setMinimumHeight(500);
          scene.addItem(form);
      
          QGraphicsView view(&scene);
          view.show();
      

      Attachments

        Issue Links

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

          Activity

            People

              smd Jan Arve
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes