mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-30 13:57:59 +03:00
Imported Upstream version 0.26.0
This commit is contained in:
commit
9a2b6c69b6
1398 changed files with 212217 additions and 0 deletions
35
extern/shiny/Editor/PropertySortModel.cpp
vendored
Normal file
35
extern/shiny/Editor/PropertySortModel.cpp
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "PropertySortModel.hpp"
|
||||
|
||||
#include "Query.hpp"
|
||||
|
||||
#include <iostream>
|
||||
sh::PropertySortModel::PropertySortModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool sh::PropertySortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
if (left.data(Qt::UserRole+1).toInt() != 0 && right.data(Qt::UserRole+1).toInt() != 0)
|
||||
{
|
||||
int sourceL = left.data(Qt::UserRole+1).toInt();
|
||||
int sourceR = right.data(Qt::UserRole+1).toInt();
|
||||
|
||||
if (sourceL > sourceR)
|
||||
return true;
|
||||
else if (sourceR > sourceL)
|
||||
return false;
|
||||
}
|
||||
|
||||
int typeL = left.data(Qt::UserRole).toInt();
|
||||
int typeR = right.data(Qt::UserRole).toInt();
|
||||
|
||||
if (typeL > typeR)
|
||||
return true;
|
||||
else if (typeR > typeL)
|
||||
return false;
|
||||
|
||||
QString nameL = left.data().toString();
|
||||
QString nameR = right.data().toString();
|
||||
return nameL > nameR;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue