Results 1 to 3 of 3

Thread: How to get the itemCount in QTableView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default How to get the itemCount in QTableView

    Hi All,


    I am using QTableView for that i have created custom model which is derived from QStanderdItemModel.

    In my application inserting rows are dynamic . i.e . i don't no the exact rows intialy As the data comes from the socket i need to append data to row in the Model.

    intially i have created

    QStanderItemModel(20,20,parent)

    Using rowcount() function i am getting 20 rows.

    but how to get the itemcount (rowCount) as the data gets added dynamically??


    Thanks

    Chethana

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to get the itemCount in QTableView

    rowCount() returns the number of rows in the model at that time.

    If that is not what you want: can you rephrase your question, please?

  3. #3
    Join Date
    Jul 2009
    Posts
    139
    Thanks
    13
    Thanked 59 Times in 52 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to get the itemCount in QTableView

    Are you using fetchMore? If so, you could connect to the rowsInserted signal. If not, rowCount should provide the correct count and if it doesn't your model is broken.

Similar Threads

  1. Replies: 5
    Last Post: 24th July 2009, 22:30
  2. Replies: 2
    Last Post: 7th June 2009, 10:47
  3. Replies: 3
    Last Post: 29th January 2009, 08:38
  4. QTableView
    By dragon in forum Qt Programming
    Replies: 0
    Last Post: 22nd September 2008, 16:53
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

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.