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. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Adding to a QTableview directly through a row

    That doesn't sounds so difficult on first sight.

    Your model reports a rowCount() that is one up from what you have actual data for, thus displaying an empty row at the end.

    In your row data structure you have a flag that marks that row as either valid or invalid.
    Your data() method uses this to return the respective background color.

    Cheers,
    _

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

    SpiceWeasel (9th 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.