Results 1 to 6 of 6

Thread: QTableView has constant number of rows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: QTableView has constant number of rows

    When you modify (or add to) the underlying data (you passed the std::vector by pointer) the model will obviously not know about it.

    So, you have to choices:
    i) make all modifications by interacting with your model class (and emit the appropriate signals there; that way you have the possibility to be more precise and say things like "20 rows have been added" - allowing you to keep the current selection...)
    ii) modify the underlying data and tell the model afterwards about it, so it can reset itself (QAbstractItemModel::reset(); you will lose the current selection) that way

    usually, when dealing with a model, all changes to the models data should be made through the model. otherwise you kinda defeat its purpose...

    HTH

  2. The following user says thank you to caduel for this useful post:

    tomeks (10th December 2008)

Similar Threads

  1. Set height of QTableView to fit exact number of rows.
    By Ben.Hines in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2019, 01:49
  2. Remove selected rows from a QTableView
    By niko in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2016, 12:49
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  4. Replies: 6
    Last Post: 5th March 2006, 21:05
  5. QTableView number of rows and scrollbar issue
    By jnk5y in forum Qt Programming
    Replies: 3
    Last Post: 1st March 2006, 06:55

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.