Results 1 to 1 of 1

Thread: sorted table

  1. #1
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question sorted table

    hiiii

    i need to sort my table in ascendin order after adding a row to my table..
    i wrote dis::

    Qt Code:
    1. QPair<int,int> item ;
    2. item.first=phyaddr;
    3. item.second=y;
    4. memoryList.append(item);
    5. table->insertRow(table->rowCount());
    6. fir->setText(QString::number(phyaddr));
    7. sec->setText(QString::number(y));
    8. table->setItem(row, 0, fir);
    9. table->setItem(row, 1, sec);
    10. table->sortItems(0,Qt::AscendingOrder );
    To copy to clipboard, switch view to plain text mode 

    i also tried dis while creating the table in addition to above code without the last line::

    Qt Code:
    1. table->sortByColumn(0,Qt::AscendingOrder);
    2. table->setSortingEnabled(true);
    To copy to clipboard, switch view to plain text mode 

    bt the problem with dis is the addition of the row is not takin place correctly....

    its adding first column to first row..n second col is remainin blank
    the second col is changed in the last row...

    thus a total mess...wat do i do..????
    Last edited by wysota; 14th March 2009 at 10:01. Reason: missing [code] tags

Similar Threads

  1. Postgresql QSqlRelationalTableModel empty table
    By RolandHughes in forum Qt Programming
    Replies: 0
    Last Post: 12th November 2008, 18:18
  2. Replies: 3
    Last Post: 6th October 2008, 00:41
  3. how to add sub table to QSqlRelationalTableModel
    By SunnySan in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2008, 12:05
  4. displaying any table on a qdatatable
    By Philip_Anselmo in forum Newbie
    Replies: 4
    Last Post: 9th May 2006, 23:12
  5. creating table plugin
    By mgurbuz in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2006, 14:50

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.