[Qt-interest] QVBoxLayout with 100s of items is hanging

Qt Quest qt.quest at yahoo.com
Wed Nov 25 22:20:04 CET 2009


Hi all,

I'm
using QT 4.5.0 to develop a GUI application, which needs to display
houndreds and sometimes thousands of text lines inside a QVBoxLayout.
Each line is QHBoxLayout with a rich text label. After show() is called
on that window a flow of event start that takes *10s of seconds* until
it is drawn.
I think the problem is in QBoxLayout::setGeometry with
e.g. n=1300. Now, the geometry of the window is not being changed, no resize
is being done. Within this function Qt tests:
    if (d->dirty || r != geometry()) {
Every time I checked dirty it was 0. So it must be the geometry values changing...
Any reason that should happen?

How can I reduce the drawing time drastically?
Any idea will be appreciated.
Thank you!


Here's an example call stack which you can find if you pause the program while it hangs:

0    QWidget::testAttribute_helper    qwidget.cpp    9905    
1    QWidgetItem::setGeometry    qwidget.h    997    
2    QBoxLayout::setGeometry    qboxlayout.cpp    860    
3    QBoxLayout::setGeometry    qboxlayout.cpp    867    
4    QLayoutPrivate::doResize    qlayout.cpp    638    
5    QLayout::activate    qlayout.cpp    1211    
6    QWidget::setVisible    qwidget.cpp    6913    
7    QWidget::qt_metacall    moc_qwidget.cpp    205    
8    QFrame::qt_metacall    moc_qframe.cpp    86    
9    QLabel::qt_metacall    moc_qlabel.cpp    96    
10    QObject::event    qobject.cpp    1109    
11    QWidget::event    qwidget.cpp    7913    
12    QFrame::event    qframe.cpp    559    
13    QLabel::event    qlabel.cpp    948    
14    QApplicationPrivate::notify_helper    qapplication.cpp    4084    
15    QApplication::notify    qapplication.cpp    3980    
16    QCoreApplication::notifyInternal    qcoreapplication.cpp    602    
17    QCoreApplicationPrivate::sendPostedEvents    qcoreapplication.h    213    
18    postEventSourceDispatch    qcoreapplication.h    218    
19    g_main_context_dispatch    /lib64/libglib-2.0.so.0    0    
20    QWidget::inputMethodEvent    qcoreevent.h    284    
21    g_main_context_iteration    /lib64/libglib-2.0.so.0    0    
22    QEventDispatcherGlib::processEvents    qeventdispatcher_glib.cpp    323    
23    QGuiEventDispatcherGlib::processEvents    qguieventdispatcher_glib.cpp    202    
24    QEventLoop::processEvents    qeventloop.cpp    149    
25    QEventLoop::exec    qeventloop.cpp    200    
26    QCoreApplication::exec    qcoreapplication.cpp    880    
27    main    main.cpp    30    


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091125/a1652a67/attachment.html 


More information about the Qt-interest-old mailing list