hiiii
i need to sort my table in ascendin order after adding a row to my table..
i wrote dis::
QPair<int,int> item ;
item.first=phyaddr;
item.second=y;
memoryList.append(item);
table->insertRow(table->rowCount());
fir
->setText
(QString::number(phyaddr
));
table->setItem(row, 0, fir);
table->setItem(row, 1, sec);
table->sortItems(0,Qt::AscendingOrder );
QPair<int,int> item ;
item.first=phyaddr;
item.second=y;
memoryList.append(item);
table->insertRow(table->rowCount());
QTableWidgetItem *fir = new QTableWidgetItem();
QTableWidgetItem *sec = new QTableWidgetItem();
fir->setText(QString::number(phyaddr));
sec->setText(QString::number(y));
table->setItem(row, 0, fir);
table->setItem(row, 1, sec);
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::
table->sortByColumn(0,Qt::AscendingOrder);
table->setSortingEnabled(true);
table->sortByColumn(0,Qt::AscendingOrder);
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..????
Bookmarks