×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    QListView - very slow

    Hi,

    i have a list with about 50 items. i'm showing those items on QListView through QSqlQueryModel. And the list is extremely slow.
    First i thought that is because i use Pixmaps from resources with Qt:ecorationRole. But even after i removed them, no good - still slow.
    I've tried setUniformItemSizes (true); and building my app in release mode... but it didn't help either. It's fast on simulator, but on Nokia X6.

    Any suggestions?

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: QListView - very slow

    Is you app have only one (GUI) thread?
    If yes, you have to split up MVC from data source. I'e data for model have to come from another thread
    Symbian & Qt developer. http://vladest.org

  3. #3
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: QListView - very slow

    Yes, only one thread. I have sub-classed QSqlQueryModel.

    Any hints on how to do that? because i just simply do setQuery() on QSqlQueryModel and setModel on QListView. What should i put on another thread?

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: QListView - very slow

    write own model or subcluss QSqlQueryModel and extend setQuery()
    threading will not speed up queries but get rid of GUI freezes
    Symbian & Qt developer. http://vladest.org

  5. #5
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: QListView - very slow

    why should i extend setQuery ? I'm simply setting query strin in it. And looking at debug output, i see that QSqlQueryMode::data gets called a lot of time when i scroll. Maybe that is the problem?

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QListView - very slow

    Is you query simple SELECT x FROM y or do you have more complicated query?

  7. #7
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: QListView - very slow

    Simple select, even no WHERE clause. DB Table is currenlty very small, about 50 items. Have found this today http://stackoverflow.com/questions/2...croll-smoothly maybe that is the case...

  8. #8
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: QListView - very slow

    Ok, the problem is not in listview. The problem is with MainWindow and ListView background that i use. If i remove them... everything scrolls and kinetics work superb.

    So question is, how do i correctly set background image? What i currently have, is :

    #BrandTabs { border-image:url(:/images/background.png); } - set on my MainWindow stylesheet
    #listView { border-image:url(:/images/background.png); } - set on my QListView

    If i remove both of them - it works great. If i leave it at least on window - list becomes very slow. background.png is image of 320x480 pixels.

    Thanks,

  9. #9
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QListView - very slow

    Think about what has to be repainted when. Every time the content of a view changes the background has to be repainted first.

    Some info here: http://doc.qt.nokia.com/latest/qwidg...uble-buffering

  10. #10
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: QListView - very slow

    Thanks for the link. Well ... it may have something to do with the way stylesheets are used, and that border-image stretches my image, and that is the source of the problem.

    Cause if use code like this:

    QPixmap bg(":/images/background.png");

    QPalette p(palette());
    p.setBrush(QPalette::Background, bg);
    setAutoFillBackground(true);
    setPalette(p);;
    it works just as smoothly, i can even set the same for window and listView, and still no performance penalty. Though background repeats, and does not stretch. But it seems kind of ok solution, i should just tweak background a bit, so that repeating wouldn't be so visible.

Similar Threads

  1. Replies: 3
    Last Post: 2010-12-23, 08:00
  2. Qmenu menu with Qlistview
    By soni_neeraj in forum Qt
    Replies: 3
    Last Post: 2010-09-08, 12:32
  3. QListview with Checkboxes
    By damodharan in forum Qt
    Replies: 1
    Last Post: 2010-04-25, 09:11
  4. slow slow Series_60_MIDP_Concept_SDK_BETA_0_3_1 emmulator
    By dd_plus in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2004-08-09, 10:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×