Results 1 to 20 of 23

Thread: rowCount() is calling for all the top level items

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: rowCount() is calling for all the top level items

    Quote Originally Posted by prasad_N View Post
    yes, There is a delay in populating data (I have populated 30 million rows with column count > 10).
    Maybe you can populate the model in batches? I think you could use canFetchMore() && fetchMore() for the invalid model index.

    One more problem:
    And rowCount() is calling for all top level items when I emit headerDataChanged() signal which leads to further delay in selecting item & changing header.
    Think how to avoid changing the header too often. You can always show a custom header instead of the default one.
    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.


  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Smile Re: rowCount() is calling for all the top level items

    Sorry I could not get you properly.

    Quote Originally Posted by wysota View Post
    Maybe you can populate the model in batches? I think you could use canFetchMore() && fetchMore() for the invalid model index.
    You mean populating model with half data.
    Actually I have more than 100 million of rows (would be more also) because of this BUG (https://bugreports.qt.io/browse/QTBUG-28631), I went for pages (I will have combo box top of the view with 0 - totalRows/30 million ranges), so each time I chose a number I am building a tree of respective range and showing that tree so that I am showing 30 million of rows at a time in view, but this is also causing performance problems.

    with fetchMore() & canFetchMore() i will have scroll bar problem I think, when I come to end of the scroll then only I would come to know there is more elements and then I will load the data and then the scroll bar will adjust according to that, I don't want this behavior scroll bar size should be decide at first instance only(This is the reason I am not using fetchMore functionality in my app).


    One more problem:

    Think how to avoid changing the header too often. You can always show a custom header instead of the default one.
    You mean, you want me to customize the header also ?


    Can you be more verbose for the above 2 statements :-)
    Thanks :-)

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: rowCount() is calling for all the top level items

    Quote Originally Posted by prasad_N View Post
    You mean populating model with half data.
    I mean populate as much as is currently useful for you. If the user scrolls down, populate more, etc.

    with fetchMore() & canFetchMore() i will have scroll bar problem I think, when I come to end of the scroll then only I would come to know there is more elements and then I will load the data and then the scroll bar will adjust according to that, I don't want this behavior scroll bar size should be decide at first instance only(This is the reason I am not using fetchMore functionality in my app).
    You are out of luck then You can file a bug or provide a patch for the (IMO incorrect) behaviour.

    You mean, you want me to customize the header also ?


    Can you be more verbose for the above 2 statements :-)
    You can hide the original header and replace it with your own instance of QHeaderView that is not tied to the model as I understand you want your header to reflect the current view state rather than the model's data.
    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.


  4. #4
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: rowCount() is calling for all the top level items

    I report a bug in Qt bug tracker for this.

    Quote Originally Posted by wysota View Post
    You can hide the original header and replace it with your own instance of QHeaderView that is not tied to the model as I understand you want your header to reflect the current view state rather than the model's data.
    I want my header to be changed depends on the row I clicked (for ex: if I click on a even row (index.row()%2 == 0 ) I put one header set & for odd row I put another header set).
    in this case how a customized header can help me ?
    And I could not see any function for setting data (if I customize QHeaderView) rather than QHeaderView::setRootIndex(QModelIndex);

    Thanks.
    Last edited by prasad_N; 15th July 2015 at 19:39.
    Thanks :-)

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: rowCount() is calling for all the top level items

    The header takes its data from headerData() method of the model. Simply provide a custom model for it. It can even be empty just make it return whatever you need from headerData().
    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.


  6. The following user says thank you to wysota for this useful post:

    prasad_N (16th July 2015)

  7. #6
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: rowCount() is calling for all the top level items

    Quote Originally Posted by wysota View Post
    The header takes its data from headerData() method of the model. Simply provide a custom model for it. It can even be empty just make it return whatever you need from headerData().
    Thanks, It did worked with the sample I provided here, need to check with my project hope will work :-)
    Thanks :-)

Similar Threads

  1. Replies: 10
    Last Post: 21st May 2015, 18:11
  2. Replies: 16
    Last Post: 12th May 2015, 21:46
  3. Replies: 1
    Last Post: 14th March 2013, 22:50
  4. QTreeWidget::findItems only searches top level items ?
    By krisha in forum Qt Programming
    Replies: 3
    Last Post: 27th October 2011, 08:28
  5. Replies: 4
    Last Post: 4th June 2007, 12:07

Tags for this Thread

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.