mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 20:09:43 +00:00
Use default sort until a more generic sort that uses numeric order can be implemented.
This commit is contained in:
parent
e1197e75bc
commit
4fd7537155
1 changed files with 1 additions and 17 deletions
|
@ -51,21 +51,5 @@ void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr<CSMFilter::
|
|||
|
||||
bool CSMWorld::IdTableProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
if(headerData(left.column(), Qt::Horizontal).toString() != "ID")
|
||||
return QSortFilterProxyModel::lessThan(left, right);
|
||||
|
||||
QRegExp cellPattern = QRegExp("^#(\\D?\\d+) +(\\D?\\d+)");
|
||||
|
||||
int leftResult = cellPattern.indexIn(sourceModel()->data(left).toString());
|
||||
int leftX = cellPattern.cap(1).toInt();
|
||||
int leftY = cellPattern.cap(2).toInt();
|
||||
|
||||
int rightResult = cellPattern.indexIn(sourceModel()->data(right).toString());
|
||||
int rightX = cellPattern.cap(1).toInt();
|
||||
int rightY = cellPattern.cap(2).toInt();
|
||||
|
||||
if(leftResult != -1 && rightResult != -1)
|
||||
return(leftX < rightX) || (leftX == rightX && leftY <= rightY);
|
||||
else
|
||||
return QSortFilterProxyModel::lessThan(left, right);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue