Results 1 to 16 of 16

Thread: QT4 layout of complex dialog is very slow

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2006
    Posts
    46
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QT4 layout of complex dialog is very slow

    I don't use the Qt Designer - all of this layout is done in code. While investigating with this problem, I changed my code so that creation and presentation are broke into 3 steps

    1. create all widgets (called once)
    2. place all widgets in layout (called once)
    3. update widget contents, show/hide widgets based on data changes (called initially + as needed for changes)

    Actually, I have done some more investigation this morning with a profiler and have discovered some interesting facts. The layout is slow, but it is the creation of the widgets which is really taking most of the time. For example, doing just the following in a parent widget ctor takes 577 milliseconds!

    Qt Code:
    1. lbInfoName = new QLabel;
    2. lbInfo = new QLabel;
    3. lbTableName = new QLabel;
    4. lbType = new QLabel("Type");
    5. cbType = new QComboBox;
    6. ckFlipX = new QCheckBox("Flip X");
    7. ckFlipY = new QCheckBox("Flip Y");
    8. ckSwapXY = new QCheckBox("Swap XY");
    9. lbName = new QLabel("Name");
    10. leName = new QLineEdit;
    11. lbAddress = new QLabel("Address");
    12. leAddress = new QLineEdit;
    13. lbCategory = new QLabel("Category");
    14. cbCategory = new QComboBox;
    15. lbElements = new QLabel("Elements");
    16. leElements = new QLineEdit;
    17. cbScaling = new QComboBox;
    18. lbScaling = new QLabel("Scaling");
    19. pbScaling = new QPushButton("New Scaling...");
    20. teStaticValues = new QTextEdit;
    21. teDescription = new QTextEdit;
    22. gbStaticValues = new QGroupBox;
    23. gbDescription = new QGroupBox;
    To copy to clipboard, switch view to plain text mode 

    There are 6 such parent widgets in my dialog, and along with about 1 second spent on layout and other Qt operations taking another second or more, the dialog takes closer to 6 seconds to display, which is an eternity. I looked more carefully at the time spent in Qt widget ctors, and there wasn't really one type of widget that was much slower than another. Most of the actual CPU cycles end up being spent in the function

    QWidgetPrivate::create_sys

    Which accounts for almost 3.5 seconds (!) of the time to show this dialog.

    I have tried running Debug .vs. Release builds, Plastique .vs. standard styles, but nothing has an effect on the speed. My system is a XPSP2, 2.8GHz P4, 800MHz FSB, 1GB CL2 RAM, AGP8X nVidia GeForce4 MX440 running dual DVI displays. It seems like some core part of creating the widgets on the native OS is slow, perhaps in Windows itself. I just don't see things being slow anywhere else on my system, or even in other parts of my app (although I don't create so many widgets anywhere else).

    Any ideas?
    Last edited by cboles; 17th March 2006 at 18:33.

Similar Threads

  1. Issue with Modelless dialog on Mac
    By Satyanarayana Chebrolu in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2009, 10:10
  2. Replies: 2
    Last Post: 9th July 2008, 22:28

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
  •  
Qt is a trademark of The Qt Company.