For numerical sortiing, set the data as integers, not as text:
QTableWidgetItem* item = ...
// item->setText("2"); // <-- not like this
item->setData(Qt::DisplayRole, 2); // but this
For case insensitive sorting, you might need to reimplement QTableWidgetItem::operator<() (http://doc.trolltech.com/4.2/qtablewidgetitem.html#operator-lt).
按数字排序,按字母排序。
按数字排序用setData,按字母排序用setText
使用sortByColumn进行排序。