Results 1 to 5 of 5

Thread: Extra empty rows in QTableView when sorting columns

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Extra empty rows in QTableView when sorting columns

    Hello!

    I am working with QTableView and its model is a subclass of QAbstractTableModel. I have to sort columns on the tableview. I do that by SQL queries (ORDER BY). So when sorting I refresh my model. When I click on the tableview headers there is sorting but there are also extra empty rows in the bottom of the tableview that cannot be selected by mouse click. When you click again on the headers these extra rows are disappearing one by one (with one new click one empty row disappears). What can I do to solve this problem? I have googled the issue but there are no results. Please, help me.
    Last edited by tehman; 15th June 2012 at 08:28.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Extra empty rows in QTableView when sorting columns

    The model is broken but we have no way of telling you how.

  3. #3
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Extra empty rows in QTableView when sorting columns

    Thank you for the reply. You mean it is a kind of bug in Qt?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Extra empty rows in QTableView when sorting columns

    No, I mean it is a kind of bug in your code. You tell us "its model is a subclass of QAbstractTableModel", which means you have written your own model. Since the view is standard and faithfully does what the model tells it to the model must be defective in some way. We have no way to tell you how your model is broken because we cannot see it.

  5. #5
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Extra empty rows in QTableView when sorting columns

    Yup, I get it. I decided to use QSortFilterProxyModel and that solved my problem.

Similar Threads

  1. Replies: 4
    Last Post: 8th February 2012, 14:16
  2. Sorting columns of the QTableView
    By Qiieha in forum Qt Programming
    Replies: 8
    Last Post: 9th May 2011, 20:24
  3. Weird problem resizing rows and columns in qtableview
    By Tiansen in forum Qt Programming
    Replies: 1
    Last Post: 27th December 2010, 15:26
  4. Replies: 8
    Last Post: 14th August 2008, 16:48
  5. Spanned Item Spacing on Empty Columns
    By giverson in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2007, 23:10

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.