1/* -*- C++ -*-
2 This file is part of ThreadWeaver.
3
4 SPDX-FileCopyrightText: 2005-2014 Mirko Boehm <mirko@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "ImageListFilter.h"
10
11#include "Model.h"
12
13ImageListFilter::ImageListFilter(Image::Steps step, QObject *parent)
14 : QSortFilterProxyModel(parent)
15 , m_step(step)
16{
17 setSortRole(Model::Role_SortRole);
18 setDynamicSortFilter(true);
19 sort(column: 0, order: Qt::AscendingOrder);
20}
21
22bool ImageListFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
23{
24 const QModelIndex index(sourceModel()->index(row: source_row, column: 0, parent: source_parent));
25 const int step = index.data(arole: Model::Role_StepRole).value<int>();
26 return step == m_step;
27}
28
29#include "moc_ImageListFilter.cpp"
30

source code of threadweaver/examples/ThumbNailer/ImageListFilter.cpp