Results 1 to 9 of 9

Thread: Stylesheets affect performance

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Stylesheets affect performance

    Hi,
    I have an application that I give a custom look with stylesheets. However the performance was really bad, and it turned out to be the use of stylesheets that caused the problems. When removing the stylesheets the performance was much better. So far the UI is really simple, just four stacked widgets and a few frames and buttons. The stylesheets are also very simple.

    Example:
    In each stacked widget I have one of these frames.

    Qt Code:
    1. QFrame inner_frame1 = new QFrame(this);
    2. inner_frame1->setGeometry(10, 10, 1242, 625);
    3. inner_frame1->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
    4.  
    5. QFrame inner_frame2 = new QFrame(this);
    6. inner_frame2->setGeometry(10, 10, 242, 125);
    7. inner_frame2->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
    8.  
    9. QFrame inner_frame3 = new QFrame(this);
    10. inner_frame3->setGeometry(10, 10, 1242, 625);
    To copy to clipboard, switch view to plain text mode 

    Changing to the widget with inner_frame1 is much slower than changing to the other two. The combination of a StyleSheet and a bigger area affect performance. I have tried other types of widgets, such as QLabel, with the same result.


    Does anyone know:
    Is this a known problem and are there any ways to avoid it?

    Does the use of stylesheets require much more resources? The performance problems are mainly seen when I run on a computer on module which has a little limited resources.

    Thanks,
    Fredrik
    Last edited by wysota; 2nd February 2011 at 11:12. Reason: missing [code] tags

Similar Threads

  1. StyleSheets: border-image performance
    By GuS in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2013, 12:42
  2. Stylesheets Performance
    By Steven in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2011, 11:34
  3. Stylesheets
    By FuryCradle in forum Newbie
    Replies: 2
    Last Post: 26th September 2009, 21:34
  4. stylesheets with RGB
    By tommy in forum Qt Programming
    Replies: 4
    Last Post: 13th December 2007, 01:02
  5. Replies: 3
    Last Post: 30th April 2006, 19:22

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.