Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A really stupid question - what is the MAXIMUM widgets I can have?

A really stupid question - what is the MAXIMUM widgets I can have?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    When my code gets too convoluted I generally build an new code and do not bother to delete the old stuff. Deleting creates "missing variables" and it is too time consuming to clean up...
    I do not care if the unused stuff stays in the code - it is unused.
    I run into "too many QEditText " widgets - my app started crashing.
    So I deleted the widget causing the crash and went back to reusing some older code.

    The question is - is there areal limit in number of widgets in the application ?

    I am using GUI "frame" as a wrapper to copy the containing widgets - but if there is a limit I need to modify my ways.

    Christian EhrlicherC 1 Reply Last reply
    0
    • A Anonymous_Banned275

      When my code gets too convoluted I generally build an new code and do not bother to delete the old stuff. Deleting creates "missing variables" and it is too time consuming to clean up...
      I do not care if the unused stuff stays in the code - it is unused.
      I run into "too many QEditText " widgets - my app started crashing.
      So I deleted the widget causing the crash and went back to reusing some older code.

      The question is - is there areal limit in number of widgets in the application ?

      I am using GUI "frame" as a wrapper to copy the containing widgets - but if there is a limit I need to modify my ways.

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @AnneRanch said in A really stupid question - what is the MAXIMUM widgets I can have?:

      The question is - is there areal limit in number of widgets in the application ?

      There is no hard limit - I would guess it would be getting slow when you create more than thousands widgets (and showing them). Your crash is most likely not related to your amount of widgets but some other stuff (e.g. accessing invalid/already deleted pointers).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @AnneRanch said:

        When my code gets too convoluted I generally build an new code and do not bother to delete the old stuff.

        That's horrible.

        Deleting creates "missing variables" and it is too time consuming to clean up...

        That's also horrible.

        I do not care if the unused stuff stays in the code - it is unused.

        Still - compiles and takes time and space.

        I run into "too many QEditText " widgets - my app started crashing.

        I highly doubt the crash was caused by too many widgets.

        The question is - is there areal limit in number of widgets in the application ?

        Theoretically no. Practically, internally, I can imagine there might be some counter or a container somewhere, so you'd be limited by how big they can get. Probably some int so 2^32 or something like that.

        Maximum number of widgets is not a realistic problem. It would be in millions if it exists. You'd be hitting an out of memory problem loooong before you'd reach that. From an application architecture point of view - if you have more widgets than you can actually fit onto screen at the same time then you probably have a serious design problem.

        1 Reply Last reply
        5
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          Windows has a limit on the number of user objects that a process can have, 10000. This includes windows (widgets) and other things. It is more complicated than just that number though; the system has an overall limit like 32768.
          Pushing the Limits of Windows: USER and GDI Objects – Part 1
          Pushing the Limits of Windows: USER and GDI Objects – Part 2

          Do not know for X11.

          Chris KawaC 1 Reply Last reply
          0
          • C ChrisW67

            Windows has a limit on the number of user objects that a process can have, 10000. This includes windows (widgets) and other things. It is more complicated than just that number though; the system has an overall limit like 32768.
            Pushing the Limits of Windows: USER and GDI Objects – Part 1
            Pushing the Limits of Windows: USER and GDI Objects – Part 2

            Do not know for X11.

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @ChrisW67 True, but Qt widgets are not native user objects by default. Top level windows and widgets for which you explicitly call winId() become native, otherwise they're just C++ objects, of which there is no limit. And if an app has 10000 windows or native widgets created I would again say it has a bigger, architectural problem.

            1 Reply Last reply
            3

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved