diff --git a/src/gui/Base/HFilterModel.qml b/src/gui/Base/HFilterModel.qml deleted file mode 100644 index cc81bb0f..00000000 --- a/src/gui/Base/HFilterModel.qml +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later - -import QtQuick 2.12 -import QtQml.Models 2.12 - -DelegateModel { - filterOnGroup: "filtered" - - groups: DelegateModelGroup { - id: filtered - name: "filtered" - includeByDefault: false - } - - onAcceptItemChanged: refilterAll() - - items.onChanged: { - for (let i = 0; i < inserted.length; i++) - for (let offset = 0; offset <= inserted[i].count - 1; offset++) - refilterAt(inserted[i].index + offset) - } - - - property var acceptItem: item => true - readonly property alias filtered: filtered - - - function refilterAt(index) { - const item = items.get(index) - item.inFiltered = acceptItem(item.model) - } - - function refilterAll() { - for (let i = 0; i < items.count; i++) refilterAt(i) - } - - function filteredFindIndex(id, default_=null) { - for (let i = 0; i < filtered.count; i++) - if (filtered.get(i).id === id) return i - - return default_ - } - - function filteredFind(id, default_=null) { - for (let i = 0; i < filtered.count; i++) - if (filtered.get(i).id === id) return get(i) - - return default_ - } -}