Results 1 to 7 of 7

Thread: Adding to a QTableview directly through a row

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,329
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Adding to a QTableview directly through a row

    Your model needs to implement QAbstractItemModel::setData() and emit the dataChanged() signal as described in the docs. The default item delegate used by the table view should handle the return key and call this method with the new value. (In other words, the base QTableView will just work). You also need to implement the QAbstractItemModel::flags() method to add the Qt::ItemIsEditable flag to the defaults for thhose items the user is allowed to edit.
    Last edited by d_stranz; 10th February 2015 at 00:08.

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

    SpiceWeasel (10th February 2015)

Similar Threads

  1. QTableView + QAbstractItemModel and adding rows
    By karlkar in forum Qt Programming
    Replies: 11
    Last Post: 2nd February 2016, 21:45
  2. Adding button to QTableview .
    By riarioriu3 in forum Newbie
    Replies: 9
    Last Post: 21st October 2013, 07:48
  3. Adding columns to qtableview
    By pcheng in forum Newbie
    Replies: 8
    Last Post: 11th July 2012, 08:58
  4. Adding a OK and Cancel button to QTableview
    By rex in forum Qt Programming
    Replies: 0
    Last Post: 24th July 2011, 17:32
  5. Problem with adding rows into QTableView
    By januszmk in forum Newbie
    Replies: 8
    Last Post: 14th July 2011, 09:20

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.