Hi,
I am trying to insert a series of qgraphicsviews into the cells of a dynamically expanded qgridlayout.

Here is a bit from the grid class.

Qt Code:
  1. qTrackGrid::qTrackGrid(qDocumentView *parent)
  2. : QWidget(parent),
  3. count(0)
  4. {
  5. grid = new QGridLayout(this);
  6. setLayout(grid);
  7. }
  8.  
  9. qTrackGrid::~qTrackGrid()
  10. {
  11. // delete everything
  12. for(int cc = 0; cc < count; cc++)
  13. delete views[cc];
  14. delete grid;
  15. }
  16.  
  17. void qTrackGrid::addTrackView(vwd_SV SV)
  18. {
  19. // add a new qTrackView to the next available position in the grid
  20. // hear we are enforcing that the column width be a maximum of 2
  21. int cRow = grid->rowCount();
  22. int cCol = grid->columnCount();
  23. int row = count / 2;
  24. int col = count % 2;
  25. qTrackView* tv = new qTrackView(this, SV);
  26. tv->setVisible(true);
  27. grid->addWidget(tv->viewport(), row, col);
  28. views.append(tv);
  29. qDebug() << grid->cellRect(row, col);
  30. count++;
  31. }
To copy to clipboard, switch view to plain text mode 

I would like to use something like the following code in the qTrackView class I have inserted into the grid to make sure that the image scales and displays according to the current size of the qTrackGrid widget.

Qt Code:
  1. qTrackView::qTrackView(QWidget *parent, vwd_SV iSV)
  2. : QGraphicsView(parent),
  3. SV(iSV),
  4. buff(NULL),
  5. size(0)
  6. {
  7. // create the scene
  8. scene = new QGraphicsScene;
  9. setScene(scene);
  10.  
  11. // update the view
  12. updateView();
  13. }
  14.  
  15. void qTrackView::resizeEvent(QResizeEvent *event)
  16. {
  17. fitInView(scene->sceneRect(), Qt::IgnoreAspectRatio);
  18. }
To copy to clipboard, switch view to plain text mode 

I dont seem to be getting the resizing working as it would if the QGraphicsView object was inserted into the the widget without it being a cell of a QGridLayout.

I am setting up the qTrackView class with a QGraphicsScene as you can see from the constructor.

Its obvious that I am missing something just havent got my head around it yet.

Thanks,
Dave...