Get updated size of QGraphicsView

Posted by onurozcelik on Stack Overflow See other posts from Stack Overflow or by onurozcelik
Published on 2010-05-17T19:29:14Z Indexed on 2010/06/14 0:52 UTC
Read the original article Hit count: 296

Filed under:
|
|
|

Hi,

In my Qt Application I am dynamically creating QGraphicsView(s) and adding them inside a QGridLayout. When I add first view inside grid, the view covers all the available space inside grid. Then I add second view and there are now two equally sized views inside grid. Then I add third view and there are now three equally sized views inside grid. And so on.

How can I get updated size of first view?

Below is my trial but I think this is not working.

//Definition of viewsPerRow
 static const int viewsPerRow = 3;
 void window::newViewRequested()
 {
     QGraphicsView *view = new QGraphicsView;
     view->setVisible(true);
     viewVector.push_back(view);

     for(int i = viewGrid->count(); i < viewVector.count(); i++)
     {
       viewGrid->addWidget(view,i / viewsPerRow ,i % viewsPerRow);
     }
      qDebug()<<viewGrid->cellRect(0,0);
    }

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt