Hi,

When I load an image into QGraphicsScene and add the scene to QGraphicsView, 
the QGraphicsView expands to image size, but if I clear and load another image 
which is smaller, it stays the same size. 

For example, loading a 3000x2000 px image, clear, then load 150x250 px image. 
The QGraphicsView remains 3000x2000 px.

I suppose it could be the QGraphicsScene that stays big, but I can scroll out 
to 3000x2000 px.


code snippet:

/* init */

    gv = new QGraphicsView(this);
    gs = new QGraphicsScene(this);
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(gv);
    ui->frame_2->setLayout(layout);
    gv->show();


/* load */

    QPixmap pm(path);
    gs->clear();
    gs->addPixmap(pm);
    gv->setScene(gs);
    gv->update();


Any pointers or suggestions much appreciated.

Thank you,


-- 
Waitman Gobble
San Jose California USA
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to