Results 1 to 6 of 6

Thread: QTableView has constant number of rows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTableView has constant number of rows

    Hello,

    I've got a little problem with QTableView and my own model subclassed from QAbstractTableView. The model is read only, user can change/add data using external dialog. When I add some data, table has still the same number of rows and new data doesn't appear. I know the data is correctly added. When I remove some data from a model, number of rows doesn't change either, last rows of the table just becomes empty. Here is header of my model:

    Qt Code:
    1. class EmployeesTableModel : public QAbstractTableModel {
    2. Q_OBJECT
    3. public:
    4. EmployeesTableModel( QObject* parent = 0 );
    5. int rowCount(const QModelIndex &parent = QModelIndex()) const;
    6. int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
    7. QVariant data(const QModelIndex &index, int role) const;
    8. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    9. void setEmployeesList( std::vector<WPEmployee>* employees );
    10. private:
    11. std::vector<WPEmployee>* _employees;
    12. };
    To copy to clipboard, switch view to plain text mode 

    thanks for any help
    Last edited by high_flyer; 10th December 2008 at 12:13.

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.