I am creating a couple QGLWidgets and displaying them on top of each other. I mean they are above each other on the screen and not actually on top of one another. I use a QGridLayout to align these into 1 column by 'n' rows. I want to be able to double click on any one of these QGLWidgets and allow it to fill the whole screen and then double-click on the full-screen QGLWidget and go back to the previous view of displaying multiple QGLWidgets. I have the slot and signal working correctly because when I double click onto the QGLWidget, I have qDebug statements print out lines before issuing the signal and then inside the slot. But the problem seems to be coming in my handling of the QGridLayout. I create a for-loop that essentially looks like this:

Qt Code:
  1. // Written in pseudo-code as the code is on another machine
  2. for( int i = 0 ; i < numQGLWidgets ; i++ )
  3. {
  4. GridLayout->removeWidget( QListOfQGLWidgets[i] );
  5. }
To copy to clipboard, switch view to plain text mode 

To this point, I believe there should be no widgets remaining in the QGridLayout. Then I go back through the list of QGLWidgets and when it matches the one that sent the signal which is passed in as an argument, I call addWidget like this:

Qt Code:
  1. //Again in psuedo-code
  2. for( int i = 0 ; i < numQGLWidgets ; i++ )
  3. {
  4. if( QListOfQGLWidgets[i] == signalEmitter )
  5. {
  6. GridLayout->addWidget( QListOfQGLWidgets[i] );
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

But if I click on the first QGLWidget, the OpenGL drawing doubles in size and everything looks like it wants to draw on the entire window, but when you look at the middle of the screen, the second QGLWidget still appears and is still accessible to move and scale. So my question is how do I actually get these other QGLWidgets to disappear and allow the double-clicked QGLWidget to appear over the entire allotted space? Thanks!