File indexing completed on 2024-05-12 04:02:23
0001 /* -*- C++ -*- 0002 This file is part of ThreadWeaver. 0003 0004 SPDX-FileCopyrightText: 2005-2014 Mirko Boehm <mirko@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "ImageListFilter.h" 0010 0011 #include "Model.h" 0012 0013 ImageListFilter::ImageListFilter(Image::Steps step, QObject *parent) 0014 : QSortFilterProxyModel(parent) 0015 , m_step(step) 0016 { 0017 setSortRole(Model::Role_SortRole); 0018 setDynamicSortFilter(true); 0019 sort(0, Qt::AscendingOrder); 0020 } 0021 0022 bool ImageListFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const 0023 { 0024 const QModelIndex index(sourceModel()->index(source_row, 0, source_parent)); 0025 const int step = index.data(Model::Role_StepRole).value<int>(); 0026 return step == m_step; 0027 } 0028 0029 #include "moc_ImageListFilter.cpp"