You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
710 B
25 lines
710 B
#include "UBSortFilterProxyModel.h"
|
|
#include "UBDocumentController.h"
|
|
|
|
UBSortFilterProxyModel::UBSortFilterProxyModel():
|
|
QSortFilterProxyModel()
|
|
{
|
|
setDynamicSortFilter(false);
|
|
setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
}
|
|
|
|
bool UBSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
|
{
|
|
UBDocumentTreeModel *model = dynamic_cast<UBDocumentTreeModel*>(sourceModel());
|
|
|
|
if(model){
|
|
//if it's a top level folder
|
|
//in other words : myDocuments, models and trash folder
|
|
if(model->isToplevel(left) || model->isToplevel(right))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return QSortFilterProxyModel::lessThan(left, right);
|
|
}
|
|
|