COPASI API  4.16.103
CQSortFilterProxyModel.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CQSortFilterProxyModel.cpp,v $
3 // $Revision: 1.2 $
4 // $Name: $
5 // $Author: aekamal $
6 // $Date: 2009/06/22 17:19:07 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 #include "CQSortFilterProxyModel.h"
15 
16 #include "CQBaseDataModel.h"
18  : QSortFilterProxyModel()
19 {
20 }
21 
23 {
24 }
25 
26 bool CQSortFilterProxyModel::lessThan(const QModelIndex& left, const QModelIndex& right) const
27 {
28  if (dynamic_cast<CQBaseDataModel *>(sourceModel()))
29  {
30  CQBaseDataModel * m = dynamic_cast<CQBaseDataModel *>(sourceModel());
31 
32  if (m->isDefaultRow(left))
33  {
34  if (sortOrder() == Qt::AscendingOrder)
35  return false;
36  else
37  return true;
38  }
39  else if (m->isDefaultRow(right))
40  {
41  if (sortOrder() == Qt::AscendingOrder)
42  return true;
43  else
44  return false;
45  }
46  }
47 
48  return QSortFilterProxyModel::lessThan(left, right);
49 }
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
virtual bool isDefaultRow(const QModelIndex &i) const