Results 1 to 15 of 15

Thread: Issue with visuals when updating QGridLayout inside QScrollArea

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Issue with visuals when updating QGridLayout inside QScrollArea

    Hey guys, I have a QGridLayout inside a QFrame inside a QScrollArea. The QGridLayout holds lots of widgets.
    Each time a widget is added or removed, it runs this method:

    Notes:
    -TabBar is the main class; it is a QWidget
    -The updateLayout method is called whenever a tab is added or removed
    -tabLayoutScroller is a QScrollArea
    -tabLayout is a QGridLayout inside a QFrame. The QFrame is set as the main widget for tabLayoutScroller
    -tabs is a QList<QPushButton*>

    Qt Code:
    1. void TabBar::updateLayout()
    2. {
    3. tabLayoutScroller->setUpdatesEnabled(false);
    4.  
    5. for(int i = 0; i < tabLayout->columnCount(); i++)
    6. {
    7. if(!(tabLayout->itemAtPosition(0, i)))
    8. break;
    9. tabLayout->itemAtPosition(0, i)->widget()->hide();
    10. tabLayout->itemAtPosition(0, i)->widget()->deleteLater();
    11. delete tabLayout->itemAtPosition(0, i);
    12. }
    13.  
    14. QLayoutItem *child;
    15. while ((child = tabLayout->takeAt(0)) != 0)
    16. delete child;
    17.  
    18. tabLayout->invalidate();
    19.  
    20. for(int i = 0; i < tabs.count(); i++)
    21. tabLayout->addWidget(tabs.at(i), 0, tabLayout->columnCount());
    22.  
    23. tabLayoutScroller->setUpdatesEnabled(true);
    24.  
    25. tabLayoutScroller->update();
    26. tabLayoutScroller->repaint();
    27. }
    To copy to clipboard, switch view to plain text mode 

    The problem is, if I have lots of widgets open, and I close lots of them, then open lots of them... the visuals glitch out quite a bit. See:
    http://i.imgur.com/oer5q.png

    This is an odd problem that I have yet to figure out. Any help is highly appreciated; thanks all.
    Last edited by TimeBomb; 17th June 2011 at 09:39.

Similar Threads

  1. getting to the buttons inside a QGridLayout
    By mr_kazoodle in forum Newbie
    Replies: 2
    Last Post: 19th February 2011, 16:48
  2. Replies: 2
    Last Post: 29th October 2010, 09:44
  3. Resizing QGraphicsView inside a QGridLayout
    By mckinnon in forum Newbie
    Replies: 3
    Last Post: 9th September 2010, 10:15
  4. QGridLayout issue
    By talk2amulya in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2010, 18:32
  5. Problem with QScrollArea updating from 4.0.1 to 4.1.0
    By SkripT in forum Qt Programming
    Replies: 8
    Last Post: 28th January 2006, 22:35

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.