YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
logtabSorting.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#include "logtabSorting.h"
7
8LogSortFilterProxyModel::LogSortFilterProxyModel( QObject *parent ) : QSortFilterProxyModel( parent )
9{
10}
11
12bool LogSortFilterProxyModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const
13{
14 if (left.column()==0)
15 {
16 //sorting by yarprun timestamp
17 double leftDouble = this->sourceModel()->data( left ).toDouble();
18 double rightDouble = this->sourceModel()->data( right ).toDouble();
19 return leftDouble < rightDouble;
20 }
21 else if (left.column()==1)
22 {
23 //sorting by local timestamp
24 double leftDouble = this->sourceModel()->data( left ).toDouble();
25 double rightDouble = this->sourceModel()->data( right ).toDouble();
26 return leftDouble < rightDouble;
27 }
28
29 return QSortFilterProxyModel::lessThan(left,right);
30}
LogSortFilterProxyModel(QObject *parent=0)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override