File indexing completed on 2024-04-28 04:21:19

0001 // SPDX-FileCopyrightText: 2015 Tobias Leupold <tl at stonemx dot de>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 // Qt includes
0006 #include <QDate>
0007 
0008 // Local includes
0009 #include "DateTableWidgetItem.h"
0010 
0011 Settings::DateTableWidgetItem::DateTableWidgetItem(const QString &text)
0012 {
0013     setText(text);
0014 }
0015 
0016 bool Settings::DateTableWidgetItem::operator<(const QTableWidgetItem &other) const
0017 {
0018     if (data(Qt::UserRole).toDate() == QDate()
0019         && other.data(Qt::UserRole).toDate() != QDate()) {
0020         return false;
0021     } else if (data(Qt::UserRole).toDate() != QDate()
0022                && other.data(Qt::UserRole).toDate() == QDate()) {
0023         return true;
0024     } else {
0025         return data(Qt::UserRole).toDate() < other.data(Qt::UserRole).toDate();
0026     }
0027 }