Results 1 to 3 of 3

Thread: Qt 3.3 QGridLayout

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Red face Qt 3.3 QGridLayout

    I have a QGridLayout that holds multiple subclassed QGLWidgets. Occasionally I need to change the QGLWidgets held inside the QGridLayout. Whenever I need to do this I have a loop that removes the widgets and then I go about creating the widgets. The QGLWidgets are stored inside a QValueList. When I open the window containing the QGridLayout for the first time, the QGLWidgets display correctly. But when I try to switch data sets, the QGLWidgets do not display. The first displaying of the data and the displaying of the subsequent data is all using the same code so I am thinking my problems are coming when I try to remove the old QGLWidgets from the layout before creating and adding the new QGLWidgets. Here is what my removal code looks like.

    Qt Code:
    1. for( int i = 0 ; i < mpPlots.size( ) ; i++ )
    2. {
    3. mpPlotsLayout->remove( *(mpPlots.at( i ) ) );
    4. delete( *( mpPlots.at( i ) ) );
    5. }
    6. mpPlots.clear( );
    To copy to clipboard, switch view to plain text mode 

    mpPlots is a QValueList of my QGLWidgets and mpPlotsLayout is my QGridLayout. When I try to load the new data the old data does disappear but the new data does not appear. If I try to redisplay the original data it does not display anymore. If you need more information please let me know what it is you need. But since the code used to display data initially is the same as to display data later I am guessing that code is working but the code to remove the widgets from the layout is not behaving as I would expect. Thanks for your help!

  2. #2
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt 3.3 QGridLayout

    Does anybody have any ideas on what to do with this? I am still clueless on how to fix this problem. Thanks!

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Unhappy Re: Qt 3.3 QGridLayout

    I have tried changing

    Qt Code:
    1. for( int i = 0 ; i < mpPlots.size( ) ; i++ )
    2. {
    3. mpPlotsLayout->remove( *(mpPlots.at( i ) ) );
    4. delete( *( mpPlots.at( i ) ) );
    5. }
    6. mpPlots.clear( );
    To copy to clipboard, switch view to plain text mode 

    to

    Qt Code:
    1. for( int i = 0 ; i < mpPlots.size( ) ; i++ )
    2. {
    3. mpPlotsLayout->remove( mpPlots[i] );
    4. delete( mpPlots[i] );
    5. }
    6. mpPlots.clear( );
    To copy to clipboard, switch view to plain text mode 

    But this change did not change anything. I have also tried calling hide on the QGLWidget after the remove and before the delete and this didn't help anything. I have also tried just the hide( ) call without the remove( ) call and this didn't help. I have done this in Qt 4 with a call to removeWidget( ) followed by a delete( ) call but remove doesn't seem to work. Is there something I need to do with the QGLWidget's parent? Thanks again for any help you have...this is very annoying.

Similar Threads

  1. How do I add a QGridlayout in a QMainwindow?
    By Teuniz in forum Qt Programming
    Replies: 4
    Last Post: 14th February 2007, 11:18
  2. Margin size of QGridLayout
    By Cainofnod in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2007, 09:59
  3. Remove a QLayout from QGridLayout
    By grosem in forum Qt Programming
    Replies: 18
    Last Post: 2nd January 2007, 12:19
  4. QGridLayout
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 29th June 2006, 21:34
  5. QPixmap and QGridLayout
    By Talon_Karrde in forum Qt Programming
    Replies: 5
    Last Post: 22nd February 2006, 13:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.