Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Managing screens with QStackedWidget

Managing screens with QStackedWidget

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 3 Posters 3.2k Views
  • 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.
  • D Offline
    D Offline
    dpatrick
    wrote on last edited by
    #1

    Hello All,

    I have one screen with three QProgressBar and almost twenty QLabels.

    It is working fine, however it is too slow to show at the first time.

    I am using the QStackedWidget to manager my screens in my embedded application.

    When switch to other screens, the change is normal.

    What should I do to improve it?
    Reduce QLabels?, create QLabel dynamic?

    Thank all

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      It depends :-)

      Did you check where the time is gone?

      First show up includes creation of UI, loading libraries, ...
      The easiest would be use a profiler and check where the time goes, or use some logging/tracing to check it.
      After you checked where the time is used, you perhaps know what to do, not before....

      Don't try to optimize, if you don't know exactly where the bottleneck is. You will have much work and perhaps zero result.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Indeed, don't optimize blindly. Instrument your code, measure, and then find out where the bottlenecks are and tackle them one by one until you have a satisfying performance. Then, stop optimizing. Those last 20% of gains takes about 80% of your optimizing time, as a rule of thumb.

        What you might check, if if you are doing heavy lifting in your constructors. If you can avoid it, you might want to move such heavy initialization to a second phase, that you trigger with a 0 or very short interval timer. This makes sure that you get into a "running mode" quickly, that the user sees something happening immediately after starting.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          [quote author="Andre" date="1300809795"]What you might check, if if you are doing heavy lifting in your constructors. If you can avoid it, you might want to move such heavy initialization to a second phase, that you trigger with a 0 or very short interval timer. This makes sure that you get into a "running mode" quickly, that the user sees something happening immediately after starting.[/quote]

          But also this only makes sense, if the bottleneck is really the creation of the widgets. Otherwise it makes the app more complex without any benefit. I never saw that creating widgets is costly, so the user sees it.

          What is costly, is if you have heavy user interface (in my example, I have here about > 1000 widgets in several tabs and stacks) that has a huge (>3000 lines) stylesheet. On my machine (3 GB ram, Win XP, Intel Core i% 2.4 GHz) startup takes some seconds (up to 20).

          The issue is mostly the complex stylesheet that is tracked during creation of the widgets... :-(

          But it's only a test for the style, our other apps only use some widgets and have no problem with the style sheet.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0

          • Login

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