2017-04-27 18:25:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-05-28 18:00:58 +00:00
|
|
|
#include "cleanertablemodel.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "core/metrics.h"
|
2015-05-28 18:00:58 +00:00
|
|
|
|
2019-03-16 10:14:42 +00:00
|
|
|
const QPixmap &trashIcon()
|
|
|
|
{
|
|
|
|
static QPixmap trash = QPixmap(":list-remove-icon").scaledToHeight(defaultIconMetrics().sz_small);
|
|
|
|
return trash;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QPixmap &trashForbiddenIcon()
|
|
|
|
{
|
|
|
|
static QPixmap trash = QPixmap(":list-remove-disabled-icon").scaledToHeight(defaultIconMetrics().sz_small);
|
|
|
|
return trash;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QPixmap &editIcon()
|
|
|
|
{
|
|
|
|
static QPixmap edit = QPixmap(":edit-icon").scaledToHeight(defaultIconMetrics().sz_small);
|
|
|
|
return edit;
|
|
|
|
}
|
|
|
|
|
2015-05-28 18:00:58 +00:00
|
|
|
CleanerTableModel::CleanerTableModel(QObject *parent) : QAbstractTableModel(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-05-21 15:53:42 +00:00
|
|
|
int CleanerTableModel::columnCount(const QModelIndex&) const
|
2015-05-28 18:00:58 +00:00
|
|
|
{
|
|
|
|
return headers.count();
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant CleanerTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
|
|
{
|
|
|
|
if (orientation == Qt::Vertical)
|
2019-06-08 06:49:12 +00:00
|
|
|
return QVariant();
|
2015-05-28 18:00:58 +00:00
|
|
|
|
|
|
|
switch (role) {
|
|
|
|
case Qt::FontRole:
|
2019-06-08 06:49:12 +00:00
|
|
|
return defaultModelFont();
|
2015-05-28 18:00:58 +00:00
|
|
|
case Qt::DisplayRole:
|
2019-06-08 06:49:12 +00:00
|
|
|
return headers.at(section);
|
2015-05-28 18:00:58 +00:00
|
|
|
}
|
2019-06-08 06:49:12 +00:00
|
|
|
return QVariant();
|
2015-05-28 18:00:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CleanerTableModel::setHeaderDataStrings(const QStringList &newHeaders)
|
|
|
|
{
|
|
|
|
headers = newHeaders;
|
|
|
|
}
|