diff --git a/src/libs/models/ResourceItemSFModel.cpp b/src/libs/models/ResourceItemSFModel.cpp index 03040dab..15505e99 100644 --- a/src/libs/models/ResourceItemSFModel.cpp +++ b/src/libs/models/ResourceItemSFModel.cpp @@ -1,108 +1,110 @@ /* This file is part of the KDE project * Copyright (C) 2020 Dag Andersen * Copyright (C) 2019 Dag Andersen * Copyright (C) 2006 - 2007, 2012 Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ // clazy:excludeall=qstring-arg #include "ResourceItemSFModel.h" #include "ResourceItemModel.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace KPlato; ResourceItemSFModel::ResourceItemSFModel(QObject *parent) : QSortFilterProxyModel(parent) , m_project(nullptr) { setDynamicSortFilter(true); - setSourceModel(new ResourceItemModel(this)); + ResourceItemModel *m = new ResourceItemModel(this); + m->setIsCheckable(false); + setSourceModel(m); } void ResourceItemSFModel::setProject(Project *project) { static_cast(sourceModel())->setProject(project); m_project = project; } Resource *ResourceItemSFModel::resource(const QModelIndex &idx) const { return static_cast(sourceModel())->resource(mapToSource(idx)); } QModelIndex ResourceItemSFModel::index(Resource *r) const { return mapFromSource(static_cast(sourceModel())->index(r)); } Qt::ItemFlags ResourceItemSFModel::flags(const QModelIndex &index) const { Qt::ItemFlags f = QSortFilterProxyModel::flags(index); return f; } void ResourceItemSFModel::setFilteredResources(const QList &lst) { m_filteredResources = lst; } void ResourceItemSFModel::addFilteredResource(Resource *r) { if (!m_filteredResources.contains(r)) { m_filteredResources << r; } } bool ResourceItemSFModel::filterAcceptsRow(int source_row, const QModelIndex & source_parent) const { if (m_project && m_filteredResources.contains(m_project->resourceAt(source_row))) { return false; } return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); }