Results 1 to 2 of 2

Thread: Clearing QTable

  1. #1
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Clearing QTable

    What's the easiest way to clear the whole table at once? Especially if ou don't know the size of it so using QTableSelection is not possible. I know about clearCell() and clearSelection() but in both cases I need table size.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Clearing QTable

    As far as I remember the quickest way to clear the whole table was to delete its all rows (removeRow() or removeRows()) and create them again (new QTableItem...). The number of rows and columns can be obtained with numRows() and numCols(). You can use them with clearCell() too:

    Qt Code:
    1. for(int r=0;r<numRows();r++)
    2. for(int c=0;c<numCols();c++)
    3. clearCell(c,r);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Searching a QTable
    By nategoofs in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 22:15
  2. QTable selections in Qt3.3
    By Rayven in forum Qt Programming
    Replies: 1
    Last Post: 7th July 2007, 18:07
  3. QTable gives error when put on a dialog??
    By darpan in forum Qt Tools
    Replies: 3
    Last Post: 7th August 2006, 19:57
  4. Problem with QTable
    By zlatko in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 10:00
  5. QTable..Vs.. QListView
    By :db:sStrong in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2006, 21:03

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.