examples/graphicsview/anchorlayout/main.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    74     QGraphicsProxyWidget *a = createItem(minSize, prefSize, maxSize, "A");
    74     QGraphicsProxyWidget *a = createItem(minSize, prefSize, maxSize, "A");
    75     QGraphicsProxyWidget *b = createItem(minSize, prefSize, maxSize, "B");
    75     QGraphicsProxyWidget *b = createItem(minSize, prefSize, maxSize, "B");
    76     QGraphicsProxyWidget *c = createItem(minSize, prefSize, maxSize, "C");
    76     QGraphicsProxyWidget *c = createItem(minSize, prefSize, maxSize, "C");
    77     QGraphicsProxyWidget *d = createItem(minSize, prefSize, maxSize, "D");
    77     QGraphicsProxyWidget *d = createItem(minSize, prefSize, maxSize, "D");
    78     QGraphicsProxyWidget *e = createItem(minSize, prefSize, maxSize, "E");
    78     QGraphicsProxyWidget *e = createItem(minSize, prefSize, maxSize, "E");
    79     QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F");
    79     QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F (overflow)");
    80     QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G");
    80     QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G (overflow)");
    81 
    81 
    82     QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
    82     QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
    83     l->setSpacing(0);
    83     l->setSpacing(0);
    84 
    84 
    85     QGraphicsWidget *w = new QGraphicsWidget(0, Qt::Window);
    85     QGraphicsWidget *w = new QGraphicsWidget(0, Qt::Window);
   120     anchor = l->addAnchor(f, Qt::AnchorRight, g, Qt::AnchorRight);
   120     anchor = l->addAnchor(f, Qt::AnchorRight, g, Qt::AnchorRight);
   121 
   121 
   122 
   122 
   123     scene.addItem(w);
   123     scene.addItem(w);
   124     scene.setBackgroundBrush(Qt::darkGreen);
   124     scene.setBackgroundBrush(Qt::darkGreen);
   125     QGraphicsView *view = new QGraphicsView(&scene);
   125     QGraphicsView view(&scene);
   126     view->show();
   126     view.show();
   127 
   127 
   128     return app.exec();
   128     return app.exec();
   129 }
   129 }