Results 1 to 2 of 2

Thread: Upper limit on number of widgets?

  1. #1
    Join Date
    Feb 2008
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Upper limit on number of widgets?

    I have a complex application that shows a representation of information from a database. For each element in the database, I create a hierarchy of widgets - images, push buttons, scrollable editable text and so on. There are probably at least a dozen subwidgets for each of these elements - potentially more depending on the exact contents of the element.

    The problem occurs when I have a *lot* of these elements. I eventually get a series of QWidget::create: failed to create window (cannot create a top level child window) messages. I've traced this back to QWidgetPrivate::create_sys line 419 (this is Qt 4.2.2), where there is a failure to a call to CreateWindowExA. This causes all sorts of havoc, as parts of my hierarchy of widgets (mostly the text widgets) are painted over the upper left corner of my application. Both the application and, unfortunately, the debugger, become useless at this point, and I have to kill the app.

    -widgetcount tells me that I have 35 widgets left, with a max of 8258. It certainly looks like I've run out of widgets. Is there an upper limit on the number of widgets? All of my widgets are properly parented in a nice hierarchy, so I don't understand why it would want new top level widgets. Is there something I can do to consume fewer of these resources?

    Help! I don't want to try to rewrite my complex hierarchy. There are some simplifications I can make, but that seems like it will only buy me some larger upper bound. Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Upper limit on number of widgets?

    Use newer version of Qt. Since 4.4 the number of widgets shouldn't be limited in any way due to use of Aliens. An alternative is to implement your hierarchy using items and not widgets. Having 8000 widgets in a single window is madness

Similar Threads

  1. Limit number of row/column in QGridLayout
    By EricF in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2007, 19:54
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

Tags for this Thread

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.