Results 1 to 8 of 8

Thread: QListView performance issue

  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default QListView performance issue

    Hi,

    I have a tabbed application which one of them includes a QListView with custom item model & delegate. When application is minimized or maximized but one of the tabs which has no QListView in it is selected, CPU usage seems normal(about %6). But when I select a tab with a QListView, CPU usage rises to %30.

    I seems like my QListView drains too much CPU. I knew that listview is rendering continuously via delegate's paint method and most probably that causes this extensive CPU usage. Or am I wrong?

    I set my custom listview's setUniformItemSize to true but nothing changed.

    Any ideas?

    PS: I'm on Qt 4.8.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: QListView performance issue

    Listview does not coninuously render via the delegate if you don't explicitly tell it to by constantly updating the view.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QListView performance issue

    Ok then what could make it render continuously? Any suggestions for me to look at?

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QListView performance issue

    Do you call "repaint()" manually anywhere in your code ?

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QListView performance issue

    Is your custom model emitting signals that would cause the list view to reload its contents when the tab is clicked? In particular, if beginInsertRows() / endInsertRows() is happening for every row in the model, this could do it. The list would have to repaint itself for every row.

  6. #6
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QListView performance issue

    Do you call "repaint()" manually anywhere in your code ?
    Thanks for the suggestion but I've already checked it.

    In particular, if beginInsertRows() / endInsertRows() is happening for every row in the model, this could do it. The list would have to repaint itself for every row.
    Yes actually I use them just before adding a new listitem to the list(as well as I use beginRemoveRows / endRemoveRows when removing a list item). But I thought I must sort of use them. Isn't it so?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: QListView performance issue

    Do you have a custom delegate? Can you show us its code?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QListView performance issue

    Ok guys I found my silly mistake. I was setting style sheet in paintEvent function. Sorry to waste your time. Thank you.

Similar Threads

  1. QGraphicsObject Performance Issue
    By alizadeh91 in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2012, 18:41
  2. Qtwebkit performance issue ???????
    By Thành Viên Mới in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2011, 09:06
  3. QGraphicsView performance issue
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2010, 08:50
  4. Performance issue
    By Skorpien126 in forum Qt Programming
    Replies: 4
    Last Post: 2nd July 2010, 17:02
  5. Performance Issue
    By linuxdev in forum Qt Programming
    Replies: 1
    Last Post: 10th December 2008, 16:00

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.