From 893c105bf242d87b93f57c01643a2ac2c09b206c Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 18 Dec 2022 18:07:32 +0300 Subject: [PATCH 1/5] removed SortFilterProxyModel sources --- client/3rd/SortFilterProxyModel/.gitignore | 77 -- .../3rd/SortFilterProxyModel/CMakeLists.txt | 61 -- client/3rd/SortFilterProxyModel/LICENSE | 8 - client/3rd/SortFilterProxyModel/README.md | 126 --- .../SortFilterProxyModel.pri | 62 -- .../SortFilterProxyModel.qbs | 65 -- .../3rd/SortFilterProxyModel/docs/index.html | 65 -- ...ml-sortfilterproxymodel-allof-members.html | 19 - .../docs/qml-sortfilterproxymodel-allof.html | 67 -- ...ml-sortfilterproxymodel-anyof-members.html | 19 - .../docs/qml-sortfilterproxymodel-anyof.html | 86 -- ...erproxymodel-expressionfilter-members.html | 20 - ...sortfilterproxymodel-expressionfilter.html | 78 -- ...lterproxymodel-expressionrole-members.html | 19 - ...l-sortfilterproxymodel-expressionrole.html | 73 -- ...erproxymodel-expressionsorter-members.html | 21 - ...sortfilterproxymodel-expressionsorter.html | 101 --- ...l-sortfilterproxymodel-filter-members.html | 19 - .../docs/qml-sortfilterproxymodel-filter.html | 65 -- ...terproxymodel-filtercontainer-members.html | 18 - ...-sortfilterproxymodel-filtercontainer.html | 61 -- ...rtfilterproxymodel-filterrole-members.html | 19 - .../qml-sortfilterproxymodel-filterrole.html | 73 -- ...filterproxymodel-filtersorter-members.html | 21 - ...qml-sortfilterproxymodel-filtersorter.html | 101 --- ...tfilterproxymodel-indexfilter-members.html | 21 - .../qml-sortfilterproxymodel-indexfilter.html | 104 --- ...sortfilterproxymodel-joinrole-members.html | 20 - .../qml-sortfilterproxymodel-joinrole.html | 83 -- ...ortfilterproxymodel-proxyrole-members.html | 15 - .../qml-sortfilterproxymodel-proxyrole.html | 35 - ...tfilterproxymodel-rangefilter-members.html | 24 - .../qml-sortfilterproxymodel-rangefilter.html | 141 --- ...filterproxymodel-regexpfilter-members.html | 23 - ...qml-sortfilterproxymodel-regexpfilter.html | 132 --- ...rtfilterproxymodel-regexprole-members.html | 20 - .../qml-sortfilterproxymodel-regexprole.html | 82 -- ...rtfilterproxymodel-rolefilter-members.html | 20 - .../qml-sortfilterproxymodel-rolefilter.html | 77 -- ...rtfilterproxymodel-rolesorter-members.html | 21 - .../qml-sortfilterproxymodel-rolesorter.html | 98 --- ...rtfilterproxymodel-singlerole-members.html | 18 - .../qml-sortfilterproxymodel-singlerole.html | 53 -- ...l-sortfilterproxymodel-sorter-members.html | 20 - .../docs/qml-sortfilterproxymodel-sorter.html | 81 -- ...terproxymodel-sortercontainer-members.html | 18 - ...-sortfilterproxymodel-sortercontainer.html | 56 -- ...oxymodel-sortfilterproxymodel-members.html | 31 - ...filterproxymodel-sortfilterproxymodel.html | 206 ----- ...filterproxymodel-stringsorter-members.html | 28 - ...qml-sortfilterproxymodel-stringsorter.html | 90 -- ...rtfilterproxymodel-switchrole-members.html | 22 - .../qml-sortfilterproxymodel-switchrole.html | 117 --- ...tfilterproxymodel-valuefilter-members.html | 21 - .../qml-sortfilterproxymodel-valuefilter.html | 100 --- .../docs/sortfilterproxymodel-qmlmodule.html | 44 - .../docs/sortfilterproxymodel.index | 156 ---- .../docs/style/offline.css | 805 ------------------ .../filters/alloffilter.cpp | 28 - .../filters/alloffilter.h | 20 - .../filters/anyoffilter.cpp | 49 -- .../filters/anyoffilter.h | 20 - .../filters/expressionfilter.cpp | 125 --- .../filters/expressionfilter.h | 41 - .../SortFilterProxyModel/filters/filter.cpp | 85 -- .../3rd/SortFilterProxyModel/filters/filter.h | 46 - .../filters/filtercontainer.cpp | 126 --- .../filters/filtercontainer.h | 68 -- .../filters/filtercontainerfilter.cpp | 28 - .../filters/filtercontainerfilter.h | 31 - .../filters/filtersqmltypes.cpp | 28 - .../filters/indexfilter.cpp | 112 --- .../filters/indexfilter.h | 37 - .../filters/rangefilter.cpp | 140 --- .../filters/rangefilter.h | 48 -- .../filters/regexpfilter.cpp | 90 -- .../filters/regexpfilter.h | 41 - .../filters/rolefilter.cpp | 45 - .../SortFilterProxyModel/filters/rolefilter.h | 31 - .../filters/valuefilter.cpp | 57 -- .../filters/valuefilter.h | 31 - client/3rd/SortFilterProxyModel/index.qdoc | 27 - client/3rd/SortFilterProxyModel/offline.css | 805 ------------------ .../proxyroles/expressionrole.cpp | 128 --- .../proxyroles/expressionrole.h | 39 - .../proxyroles/filterrole.cpp | 65 -- .../proxyroles/filterrole.h | 29 - .../proxyroles/joinrole.cpp | 83 -- .../proxyroles/joinrole.h | 36 - .../proxyroles/proxyrole.cpp | 46 - .../proxyroles/proxyrole.h | 40 - .../proxyroles/proxyrolecontainer.cpp | 64 -- .../proxyroles/proxyrolecontainer.h | 42 - .../proxyroles/proxyrolesqmltypes.cpp | 23 - .../proxyroles/regexprole.cpp | 104 --- .../proxyroles/regexprole.h | 43 - .../proxyroles/singlerole.cpp | 52 -- .../proxyroles/singlerole.h | 34 - .../proxyroles/switchrole.cpp | 168 ---- .../proxyroles/switchrole.h | 68 -- client/3rd/SortFilterProxyModel/qpm.json | 22 - .../qqmlsortfilterproxymodel.cpp | 562 ------------ .../qqmlsortfilterproxymodel.h | 146 ---- .../sorters/expressionsorter.cpp | 146 ---- .../sorters/expressionsorter.h | 43 - .../sorters/filtersorter.cpp | 81 -- .../sorters/filtersorter.h | 33 - .../sorters/rolesorter.cpp | 64 -- .../SortFilterProxyModel/sorters/rolesorter.h | 32 - .../SortFilterProxyModel/sorters/sorter.cpp | 142 --- .../3rd/SortFilterProxyModel/sorters/sorter.h | 58 -- .../sorters/sortercontainer.cpp | 126 --- .../sorters/sortercontainer.h | 68 -- .../sorters/sortersqmltypes.cpp | 23 - .../sorters/stringsorter.cpp | 117 --- .../sorters/stringsorter.h | 47 - .../sortfilterproxymodel.qdocconf | 13 - .../3rd/SortFilterProxyModel/tests/BLACKLIST | 2 - .../tests/SortFilterProxyModel.pro | 36 - .../tests/indexsorter.cpp | 21 - .../SortFilterProxyModel/tests/indexsorter.h | 20 - .../SortFilterProxyModel/tests/testroles.cpp | 48 -- .../SortFilterProxyModel/tests/testroles.h | 47 - .../tests/tst_builtins.qml | 54 -- .../tests/tst_delayed.qml | 209 ----- .../tests/tst_expressionrole.qml | 43 - .../tests/tst_filtercontainerattached.qml | 57 -- .../tests/tst_filtercontainers.qml | 103 --- .../tests/tst_filterrole.qml | 47 - .../tests/tst_filtersorter.qml | 45 - .../tests/tst_helpers.qml | 111 --- .../tests/tst_indexfilter.qml | 104 --- .../tests/tst_joinrole.qml | 45 - .../tests/tst_proxyroles.qml | 126 --- .../tests/tst_rangefilter.qml | 99 --- .../tests/tst_regexprole.qml | 54 -- .../tests/tst_rolesorter.qml | 70 -- .../tests/tst_sortercontainerattached.qml | 131 --- .../tests/tst_sorters.qml | 158 ---- .../tests/tst_sortfilterproxymodel.cpp | 2 - .../tests/tst_sourceroles.qml | 49 -- .../tests/tst_stringsorter.qml | 85 -- .../tests/tst_switchrole.qml | 99 --- .../3rd/SortFilterProxyModel/utils/utils.cpp | 59 -- client/3rd/SortFilterProxyModel/utils/utils.h | 17 - client/amnezia_application.cpp | 2 +- .../ui/pages_logic/GeneralSettingsLogic.cpp | 2 +- client/ui/pages_logic/GeneralSettingsLogic.h | 2 +- .../ui/pages_logic/ShareConnectionLogic.cpp | 1 - 149 files changed, 3 insertions(+), 11017 deletions(-) delete mode 100644 client/3rd/SortFilterProxyModel/.gitignore delete mode 100644 client/3rd/SortFilterProxyModel/CMakeLists.txt delete mode 100644 client/3rd/SortFilterProxyModel/LICENSE delete mode 100644 client/3rd/SortFilterProxyModel/README.md delete mode 100644 client/3rd/SortFilterProxyModel/SortFilterProxyModel.pri delete mode 100644 client/3rd/SortFilterProxyModel/SortFilterProxyModel.qbs delete mode 100644 client/3rd/SortFilterProxyModel/docs/index.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter-members.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel-qmlmodule.html delete mode 100644 client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel.index delete mode 100644 client/3rd/SortFilterProxyModel/docs/style/offline.css delete mode 100644 client/3rd/SortFilterProxyModel/filters/alloffilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/alloffilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/anyoffilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/anyoffilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/expressionfilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/expressionfilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/filter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/filter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/filtercontainer.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/filtercontainer.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/filtersqmltypes.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/indexfilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/indexfilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/rangefilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/rangefilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/regexpfilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/regexpfilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/rolefilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/rolefilter.h delete mode 100644 client/3rd/SortFilterProxyModel/filters/valuefilter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/filters/valuefilter.h delete mode 100644 client/3rd/SortFilterProxyModel/index.qdoc delete mode 100644 client/3rd/SortFilterProxyModel/offline.css delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/expressionrole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/expressionrole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/filterrole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/filterrole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/joinrole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/joinrole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/proxyrole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/proxyrole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/proxyrolesqmltypes.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/regexprole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/regexprole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/singlerole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/singlerole.h delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/switchrole.cpp delete mode 100644 client/3rd/SortFilterProxyModel/proxyroles/switchrole.h delete mode 100644 client/3rd/SortFilterProxyModel/qpm.json delete mode 100644 client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.cpp delete mode 100644 client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/expressionsorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/expressionsorter.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/filtersorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/filtersorter.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/rolesorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/rolesorter.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/sorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/sorter.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/sortercontainer.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/sortercontainer.h delete mode 100644 client/3rd/SortFilterProxyModel/sorters/sortersqmltypes.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/stringsorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/sorters/stringsorter.h delete mode 100644 client/3rd/SortFilterProxyModel/sortfilterproxymodel.qdocconf delete mode 100644 client/3rd/SortFilterProxyModel/tests/BLACKLIST delete mode 100644 client/3rd/SortFilterProxyModel/tests/SortFilterProxyModel.pro delete mode 100644 client/3rd/SortFilterProxyModel/tests/indexsorter.cpp delete mode 100644 client/3rd/SortFilterProxyModel/tests/indexsorter.h delete mode 100644 client/3rd/SortFilterProxyModel/tests/testroles.cpp delete mode 100644 client/3rd/SortFilterProxyModel/tests/testroles.h delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_builtins.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_delayed.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_expressionrole.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_filtercontainerattached.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_filtercontainers.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_filterrole.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_filtersorter.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_helpers.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_indexfilter.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_joinrole.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_proxyroles.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_rangefilter.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_regexprole.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_rolesorter.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_sortercontainerattached.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_sorters.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_sortfilterproxymodel.cpp delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_sourceroles.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_stringsorter.qml delete mode 100644 client/3rd/SortFilterProxyModel/tests/tst_switchrole.qml delete mode 100644 client/3rd/SortFilterProxyModel/utils/utils.cpp delete mode 100644 client/3rd/SortFilterProxyModel/utils/utils.h diff --git a/client/3rd/SortFilterProxyModel/.gitignore b/client/3rd/SortFilterProxyModel/.gitignore deleted file mode 100644 index 73d1dfdc..00000000 --- a/client/3rd/SortFilterProxyModel/.gitignore +++ /dev/null @@ -1,77 +0,0 @@ -# This file is used to ignore files which are generated -# ---------------------------------------------------------------------------- - -*~ -*.autosave -*.a -*.core -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -*.qm -.#* -*.*# -core -!core/ -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -*.qmlc -Thumbs.db -*.res -*.rc -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -*.pro.user* - -# qtcreator shadow builds -build-SortFilterProxyModel-* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - diff --git a/client/3rd/SortFilterProxyModel/CMakeLists.txt b/client/3rd/SortFilterProxyModel/CMakeLists.txt deleted file mode 100644 index 8095071f..00000000 --- a/client/3rd/SortFilterProxyModel/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -set(CMAKE_CXX_STANDARD 17) - -find_package(Qt6 REQUIRED COMPONENTS - Core - Qml -) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) # This is to find generated *.moc and *.h files in build dir - -add_library(SortFilterProxyModel OBJECT - qqmlsortfilterproxymodel.cpp - filters/filter.cpp - filters/filtercontainer.cpp - filters/rolefilter.cpp - filters/valuefilter.cpp - filters/indexfilter.cpp - filters/regexpfilter.cpp - filters/rangefilter.cpp - filters/expressionfilter.cpp - filters/filtercontainerfilter.cpp - filters/anyoffilter.cpp - filters/alloffilter.cpp - filters/filtersqmltypes.cpp - sorters/sorter.cpp - sorters/sortercontainer.cpp - sorters/rolesorter.cpp - sorters/stringsorter.cpp - sorters/expressionsorter.cpp - sorters/sortersqmltypes.cpp - proxyroles/proxyrole.cpp - proxyroles/proxyrolecontainer.cpp - proxyroles/joinrole.cpp - proxyroles/switchrole.cpp - proxyroles/expressionrole.cpp - proxyroles/proxyrolesqmltypes.cpp - proxyroles/singlerole.cpp - proxyroles/regexprole.cpp - sorters/filtersorter.cpp - proxyroles/filterrole.cpp - utils/utils.cpp - utils/utils.h -) - -target_link_libraries(SortFilterProxyModel - PRIVATE - Qt6::Core - Qt6::Qml -) - -if ((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914)) - target_compile_options(SortFilterProxyModel PUBLIC "/Zc:__cplusplus") -endif() - -target_include_directories(SortFilterProxyModel PUBLIC - ${CMAKE_CURRENT_LIST_DIR} - $ - $ -) diff --git a/client/3rd/SortFilterProxyModel/LICENSE b/client/3rd/SortFilterProxyModel/LICENSE deleted file mode 100644 index c40ee9d4..00000000 --- a/client/3rd/SortFilterProxyModel/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2016 Pierre-Yves Siret - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/client/3rd/SortFilterProxyModel/README.md b/client/3rd/SortFilterProxyModel/README.md deleted file mode 100644 index 2a0cf7c9..00000000 --- a/client/3rd/SortFilterProxyModel/README.md +++ /dev/null @@ -1,126 +0,0 @@ -SortFilterProxyModel -==================== - -SortFilterProxyModel is an implementation of `QSortFilterProxyModel` conveniently exposed for QML. - -Install -------- -##### With [qpm](https://qpm.io) : -1. `qpm install fr.grecko.sortfilterproxymodel` -2. add `include(vendor/vendor.pri)` in your .pro if it is not already done -3. `import SortFilterProxyModel 0.2` to use this library in your QML files - -##### Without qpm : -1. clone or download this repository -2. * `qmake` add `include (/SortFilterProxyModel.pri)` in your `.pro` - * `CMake` add $ to the sources of your executable target in your cmake project -3. `import SortFilterProxyModel 0.2` to use this library in your QML files - -Sample Usage ------------- - -- You can do simple filtering and sorting with SortFilterProxyModel: -```qml -import QtQuick 2.2 -import QtQuick.Controls 1.2 -import SortFilterProxyModel 0.2 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - - ListModel { - id: personModel - ListElement { - firstName: "Erwan" - lastName: "Castex" - favorite: true - } - // ... - } - - TextField { - id: textField - anchors { top: parent.top; left: parent.left; right: parent.right } - height: implicitHeight - } - - SortFilterProxyModel { - id: personProxyModel - sourceModel: personModel - filters: RegExpFilter { - roleName: "lastName" - pattern: textField.text - caseSensitivity: Qt.CaseInsensitive - } - sorters: StringSorter { roleName: "firstName" } - } - - ListView { - anchors { top: textField.bottom; bottom: parent.bottom; left: parent.left; right: parent.right } - model: personProxyModel - delegate: Text { text: model.firstName + " " + model.lastName} - } -} -``` -Here the `ListView` will only show elements that contains the content of the `TextField` in their `lastName` role. - -- But you can also achieve more complex filtering or sorting with multiple `filters` and `sorters`: -```qml - SortFilterProxyModel { - id: personProxyModel - sourceModel: personModel - filters: [ - ValueFilter { - enabled: onlyShowFavoritesCheckbox.checked - roleName: "favorite" - value: true - }, - AnyOf { - RegExpFilter { - roleName: "lastName" - pattern: textField.text - caseSensitivity: Qt.CaseInsensitive - } - RegExpFilter { - roleName: "firstName" - pattern: textField.text - caseSensitivity: Qt.CaseInsensitive - } - } - ] - sorters: [ - RoleSorter { roleName: "favorite"; sortOrder: Qt.DescendingOrder }, - StringSorter { roleName: "firstName" }, - StringSorter { roleName: "lastName" } - ] - } - - CheckBox { - id:onlyShowFavoritesCheckbox - } -``` -This will show in the corresponding `ListView` only the elements where the `firstName` or the `lastName` match the text entered in the `textField`, and if the `onlyShowFavoritesCheckbox` is checked it will aditionnally filter the elements where `favorite` is `true`. -The favorited elements will be shown first and all the elements are sorted by `firstName` and then `lastName`. - -Showcase Application --------------------- -You can find an application showcasing this library here: https://github.com/oKcerG/SFPMShowcase - -License -------- -This library is licensed under the MIT License. - -Documentation -------------- -This component is a subclass of [`QSortFilterProxyModel`](http://doc.qt.io/qt-5/qsortfilterproxymodel.html), to use it, you need to set the `sourceModel` property to a [`QAbstractItemModel*`](http://doc.qt.io/qt-5/qabstractitemmodel.html) with correct role names. -This means you can use it with custom c++ models or `ListModel`, but not with JavaScript models like arrays, integers or object instances. - -The complete documentation reference is available here: https://okcerg.github.io/SortFilterProxyModel/ - -Contributing ------------- -Don't hesitate to open an issue about a suggestion, a bug, a lack of clarity in the documentation, etc. - -Pull requests are also welcome, if it's a important change you should open an issue first though. diff --git a/client/3rd/SortFilterProxyModel/SortFilterProxyModel.pri b/client/3rd/SortFilterProxyModel/SortFilterProxyModel.pri deleted file mode 100644 index 5c42037c..00000000 --- a/client/3rd/SortFilterProxyModel/SortFilterProxyModel.pri +++ /dev/null @@ -1,62 +0,0 @@ -!contains( CONFIG, c\+\+1[14] ): warning("SortFilterProxyModel needs at least c++11, add CONFIG += c++11 to your .pro") - -INCLUDEPATH += $$PWD - -HEADERS += $$PWD/qqmlsortfilterproxymodel.h \ - $$PWD/filters/filter.h \ - $$PWD/filters/filtercontainer.h \ - $$PWD/filters/rolefilter.h \ - $$PWD/filters/valuefilter.h \ - $$PWD/filters/indexfilter.h \ - $$PWD/filters/regexpfilter.h \ - $$PWD/filters/rangefilter.h \ - $$PWD/filters/expressionfilter.h \ - $$PWD/filters/filtercontainerfilter.h \ - $$PWD/filters/anyoffilter.h \ - $$PWD/filters/alloffilter.h \ - $$PWD/sorters/sorter.h \ - $$PWD/sorters/sortercontainer.h \ - $$PWD/sorters/rolesorter.h \ - $$PWD/sorters/stringsorter.h \ - $$PWD/sorters/expressionsorter.h \ - $$PWD/proxyroles/proxyrole.h \ - $$PWD/proxyroles/proxyrolecontainer.h \ - $$PWD/proxyroles/joinrole.h \ - $$PWD/proxyroles/switchrole.h \ - $$PWD/proxyroles/expressionrole.h \ - $$PWD/proxyroles/singlerole.h \ - $$PWD/proxyroles/regexprole.h \ - $$PWD/sorters/filtersorter.h \ - $$PWD/proxyroles/filterrole.h \ - $$PWD/utils/utils.h - -SOURCES += $$PWD/qqmlsortfilterproxymodel.cpp \ - $$PWD/filters/filter.cpp \ - $$PWD/filters/filtercontainer.cpp \ - $$PWD/filters/rolefilter.cpp \ - $$PWD/filters/valuefilter.cpp \ - $$PWD/filters/indexfilter.cpp \ - $$PWD/filters/regexpfilter.cpp \ - $$PWD/filters/rangefilter.cpp \ - $$PWD/filters/expressionfilter.cpp \ - $$PWD/filters/filtercontainerfilter.cpp \ - $$PWD/filters/anyoffilter.cpp \ - $$PWD/filters/alloffilter.cpp \ - $$PWD/filters/filtersqmltypes.cpp \ - $$PWD/sorters/sorter.cpp \ - $$PWD/sorters/sortercontainer.cpp \ - $$PWD/sorters/rolesorter.cpp \ - $$PWD/sorters/stringsorter.cpp \ - $$PWD/sorters/expressionsorter.cpp \ - $$PWD/sorters/sortersqmltypes.cpp \ - $$PWD/proxyroles/proxyrole.cpp \ - $$PWD/proxyroles/proxyrolecontainer.cpp \ - $$PWD/proxyroles/joinrole.cpp \ - $$PWD/proxyroles/switchrole.cpp \ - $$PWD/proxyroles/expressionrole.cpp \ - $$PWD/proxyroles/proxyrolesqmltypes.cpp \ - $$PWD/proxyroles/singlerole.cpp \ - $$PWD/proxyroles/regexprole.cpp \ - $$PWD/sorters/filtersorter.cpp \ - $$PWD/proxyroles/filterrole.cpp \ - $$PWD/utils/utils.cpp diff --git a/client/3rd/SortFilterProxyModel/SortFilterProxyModel.qbs b/client/3rd/SortFilterProxyModel/SortFilterProxyModel.qbs deleted file mode 100644 index 23ec8472..00000000 --- a/client/3rd/SortFilterProxyModel/SortFilterProxyModel.qbs +++ /dev/null @@ -1,65 +0,0 @@ -import qbs - -Group { - name: "SortFilterProxyModel" - prefix: path + "/" - files: [ - "filters/alloffilter.cpp", - "filters/alloffilter.h", - "filters/anyoffilter.cpp", - "filters/anyoffilter.h", - "filters/expressionfilter.cpp", - "filters/expressionfilter.h", - "filters/filter.cpp", - "filters/filter.h", - "filters/filtercontainer.cpp", - "filters/filtercontainer.h", - "filters/filtercontainerfilter.cpp", - "filters/filtercontainerfilter.h", - "filters/filtersqmltypes.cpp", - "filters/indexfilter.cpp", - "filters/indexfilter.h", - "filters/rangefilter.cpp", - "filters/rangefilter.h", - "filters/regexpfilter.cpp", - "filters/regexpfilter.h", - "filters/rolefilter.cpp", - "filters/rolefilter.h", - "filters/valuefilter.cpp", - "filters/valuefilter.h", - "proxyroles/expressionrole.cpp", - "proxyroles/expressionrole.h", - "proxyroles/filterrole.cpp", - "proxyroles/filterrole.h", - "proxyroles/joinrole.cpp", - "proxyroles/joinrole.h", - "proxyroles/proxyrole.cpp", - "proxyroles/proxyrole.h", - "proxyroles/proxyrolecontainer.cpp", - "proxyroles/proxyrolecontainer.h", - "proxyroles/proxyrolesqmltypes.cpp", - "proxyroles/regexprole.cpp", - "proxyroles/regexprole.h", - "proxyroles/singlerole.cpp", - "proxyroles/singlerole.h", - "proxyroles/switchrole.cpp", - "proxyroles/switchrole.h", - "sorters/expressionsorter.cpp", - "sorters/expressionsorter.h", - "sorters/filtersorter.cpp", - "sorters/filtersorter.h", - "sorters/rolesorter.cpp", - "sorters/rolesorter.h", - "sorters/sorter.cpp", - "sorters/sorter.h", - "sorters/sortercontainer.cpp", - "sorters/sortercontainer.h", - "sorters/sortersqmltypes.cpp", - "sorters/stringsorter.cpp", - "sorters/stringsorter.h", - "utils/utils.cpp", - "utils/utils.h", - "qqmlsortfilterproxymodel.cpp", - "qqmlsortfilterproxymodel.h" - ] -} diff --git a/client/3rd/SortFilterProxyModel/docs/index.html b/client/3rd/SortFilterProxyModel/docs/index.html deleted file mode 100644 index ae3901ef..00000000 --- a/client/3rd/SortFilterProxyModel/docs/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - SortFilterProxyModel QML Module | SortFilterProxyModel - - - -

SortFilterProxyModel QML Module

- - -
-

SortFilterProxyModel is an implementation of QSortFilterProxyModel conveniently exposed for QML.

- -

SortFilterProxyModel

Filters and sorts data coming from a source QAbstractItemModel

-

- -

Filters

-
- - - - - - - - - -

AllOf

Filter container accepting rows accepted by all its child filters

AnyOf

Filter container accepting rows accepted by at least one of its child filters

ExpressionFilter

Filters row with a custom filtering

Filter

Base type for the SortFilterProxyModel filters

IndexFilter

Filters rows based on their source index

RangeFilter

Filters rows between boundary values

RegExpFilter

Filters rows matching a regular expression

RoleFilter

Base type for filters based on a source model role

ValueFilter

Filters rows matching exactly a value

- - -
- -

FilterContainer

Abstract interface for types containing Filters

- -

Sorters

-
- - - - - -

ExpressionSorter

Sorts row with a custom javascript expression

FilterSorter

Sorts rows based on if they match filters

RoleSorter

Sorts rows based on a source model role

Sorter

Base type for the SortFilterProxyModel sorters

StringSorter

Sorts rows based on a source model string role

- - -
- -

SorterContainer

Abstract interface for types containing Sorters

- -

ProxyRoles

-
- - - - - - - -

ExpressionRole

A custom role computed from a javascript expression

FilterRole

A role resolving to true for rows matching all its filters

JoinRole

Role made from concatenating other roles

ProxyRole

Base type for the SortFilterProxyModel proxy roles

RegExpRole

A ProxyRole extracting data from a source role via a regular expression

SingleRole

Base type for the SortFilterProxyModel proxy roles defining a single role

SwitchRole

A role using Filter to conditionnaly compute its data

-
- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof-members.html deleted file mode 100644 index a6b613ef..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof-members.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - List of All Members for AllOf | SortFilterProxyModel - - - - -

List of All Members for AllOf

-

This is the complete list of members for AllOf, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof.html deleted file mode 100644 index 551442ab..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-allof.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - AllOf QML Type | SortFilterProxyModel - - - - -

AllOf QML Type

- - -

Filter container accepting rows accepted by all its child filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Filter

-
- -

Properties

- - - -

Detailed Description

-

The AllOf type is a Filter container that accepts rows if all of its contained (and enabled) filters accept them, or if it has no filter.

-

Using it as a top level filter has the same effect as putting all its child filters as top level filters. It can however be usefull to use an AllOf filter when nested in an AnyOf filter.

-

See also FilterContainer.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof-members.html deleted file mode 100644 index 955d1b25..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof-members.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - List of All Members for AnyOf | SortFilterProxyModel - - - - -

List of All Members for AnyOf

-

This is the complete list of members for AnyOf, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof.html deleted file mode 100644 index 1e269e72..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-anyof.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - AnyOf QML Type | SortFilterProxyModel - - - - -

AnyOf QML Type

- - -

Filter container accepting rows accepted by at least one of its child filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Filter

-
- -

Properties

- - - -

Detailed Description

-

The AnyOf type is a Filter container that accepts rows if any of its contained (and enabled) filters accept them.

-

In the following example, only the rows where the firstName role or the lastName role match the text entered in the nameTextField will be accepted :

-
TextField {
-  id: nameTextField
-}
-
-SortFilterProxyModel {
-  sourceModel: contactModel
-  filters: AnyOf {
-      RegExpFilter {
-          roleName: "lastName"
-          pattern: nameTextField.text
-          caseSensitivity: Qt.CaseInsensitive
-      }
-      RegExpFilter {
-          roleName: "firstName"
-          pattern: nameTextField.text
-          caseSensitivity: Qt.CaseInsensitive
-      }
-  }
-}
-

See also FilterContainer.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter-members.html deleted file mode 100644 index 4233a817..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter-members.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - List of All Members for ExpressionFilter | SortFilterProxyModel - - - - -

List of All Members for ExpressionFilter

-

This is the complete list of members for ExpressionFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter.html deleted file mode 100644 index 46bb745f..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionfilter.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - ExpressionFilter QML Type | SortFilterProxyModel - - - - -

ExpressionFilter QML Type

- - -

Filters row with a custom filtering. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Filter

-
- -

Properties

- - - -

Detailed Description

-

An ExpressionFilter is a Filter allowing to implement custom filtering based on a javascript expression.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-expression : expression

-

An expression to implement custom filtering, it must evaluate to a boolean. It has the same syntax has a Property Binding except it will be evaluated for each of the source model's rows. Rows that have their expression evaluating to true will be accepted by the model. Data for each row is exposed like for a delegate of a QML View.

-

This expression is reevaluated for a row every time its model data changes. When an external property (not index or in model) the expression depends on changes, the expression is reevaluated for every row of the source model. To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes.

-

A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole-members.html deleted file mode 100644 index 8b6eeca8..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole-members.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - List of All Members for ExpressionRole | SortFilterProxyModel - - - - -

List of All Members for ExpressionRole

-

This is the complete list of members for ExpressionRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole.html deleted file mode 100644 index 0ef4acbe..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionrole.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - ExpressionRole QML Type | SortFilterProxyModel - - - - -

ExpressionRole QML Type

- - -

A custom role computed from a javascript expression. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

SingleRole

-
- -

Properties

- - - -

Detailed Description

-

An ExpressionRole is a ProxyRole allowing to implement a custom role based on a javascript expression.

-

In the following example, the c role is computed by adding the a role and b role of the model :

-
SortFilterProxyModel {
-   sourceModel: numberModel
-   proxyRoles: ExpressionRole {
-       name: "c"
-       expression: model.a + model.b
-  }
-}
- -

Property Documentation

- -
-
- - -

-expression : expression

-

An expression to implement a custom role. It has the same syntax has a Property Binding except it will be evaluated for each of the source model's rows. The data for this role will be the retuned valued of the expression. Data for each row is exposed like for a delegate of a QML View.

-

This expression is reevaluated for a row every time its model data changes. When an external property (not index or in model) the expression depends on changes, the expression is reevaluated for every row of the source model. To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes.

-

A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression.

-
-
- -
-
- - -

-name : string

-

This property holds the role name of the proxy role.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter-members.html deleted file mode 100644 index b32c15c6..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter-members.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - List of All Members for ExpressionSorter | SortFilterProxyModel - - - - -

List of All Members for ExpressionSorter

-

This is the complete list of members for ExpressionSorter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter.html deleted file mode 100644 index 09292347..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-expressionsorter.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - ExpressionSorter QML Type | SortFilterProxyModel - - - - -

ExpressionSorter QML Type

- - -

Sorts row with a custom javascript expression. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Sorter

-
- -

Properties

- - - -

Detailed Description

-

An ExpressionSorter is a Sorter allowing to implement custom sorting based on a javascript expression.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the sorter is enabled. A disabled sorter will not change the order of the rows.

-

By default, sorters are enabled.

-
-
- -
-
- - -

-expression : expression

-

An expression to implement custom sorting. It must evaluate to a bool. It has the same syntax has a Property Binding, except that it will be evaluated for each of the source model's rows. Model data is accessible for both rows with the modelLeft, and modelRight properties:

-
sorters: ExpressionSorter {
-    expression: {
-        return modelLeft.someRole < modelRight.someRole;
-    }
-}
-

The index of the row is also available through modelLeft and modelRight.

-

The expression should return true if the value of the left item is less than the value of the right item, otherwise returns false.

-

This expression is reevaluated for a row every time its model data changes. When an external property (not index* or in model*) the expression depends on changes, the expression is reevaluated for every row of the source model. To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes.

-

A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression.

-
-
- -
-
- - -

-priority : int

-

This property holds the sort priority of this sorter. Sorters with a higher priority are applied first. In case of equal priority, Sorters are ordered by their insertion order.

-

By default, the priority is 0.

-
-
- -
-
- - -

-sortOrder : Qt::SortOrder

-

This property holds the sort order of this sorter.

-
- - -
ConstantDescription
Qt.AscendingOrderThe items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrderThe items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales
-

By default, sorting is in ascending order.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter-members.html deleted file mode 100644 index b309030a..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter-members.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - List of All Members for Filter | SortFilterProxyModel - - - - -

List of All Members for Filter

-

This is the complete list of members for Filter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter.html deleted file mode 100644 index 03cc3476..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filter.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - Filter QML Type | SortFilterProxyModel - - - - -

Filter QML Type

- - -

Base type for the SortFilterProxyModel filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherited By:

AllOf, AnyOf, ExpressionFilter, IndexFilter, and RoleFilter

-
- -

Properties

- - - -

Detailed Description

-

The Filter type cannot be used directly in a QML file. It exists to provide a set of common properties and methods, available across all the other filter types that inherit from it. Attempting to use the Filter type directly will result in an error.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer-members.html deleted file mode 100644 index 9fe2f4bd..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer-members.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - List of All Members for FilterContainer | SortFilterProxyModel - - - - -

List of All Members for FilterContainer

-

This is the complete list of members for FilterContainer, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer.html deleted file mode 100644 index 2545a718..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtercontainer.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - FilterContainer QML Type | SortFilterProxyModel - - - - -

FilterContainer QML Type

- - -

Abstract interface for types containing Filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
- -

Attached Properties

- - - -

Detailed Description

- -

Types implementing this interface:

-
- - - - - - -

AllOf

Filter container accepting rows accepted by all its child filters

AnyOf

Filter container accepting rows accepted by at least one of its child filters

FilterRole

A role resolving to true for rows matching all its filters

FilterSorter

Sorts rows based on if they match filters

SortFilterProxyModel

Filters and sorts data coming from a source QAbstractItemModel

SwitchRole

A role using Filter to conditionnaly compute its data

- -

Attached Property Documentation

- -
-
- - -

-FilterContainer.container : bool

-

This attached property allows you to include in a FilterContainer a Filter that has been instantiated outside of the FilterContainer, for example in an Instantiator.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole-members.html deleted file mode 100644 index f4bb0d11..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole-members.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - List of All Members for FilterRole | SortFilterProxyModel - - - - -

List of All Members for FilterRole

-

This is the complete list of members for FilterRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole.html deleted file mode 100644 index 9d022cf5..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filterrole.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - FilterRole QML Type | SortFilterProxyModel - - - - -

FilterRole QML Type

- - -

A role resolving to true for rows matching all its filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

SingleRole

-
- -

Properties

- - - -

Detailed Description

-

A FilterRole is a ProxyRole that returns true for rows matching all its filters.

-

In the following example, the isAdult role will be equal to true if the age role is superior or equal to 18.

-
SortFilterProxyModel {
-    sourceModel: personModel
-    proxyRoles: FilterRole {
-        name: "isAdult"
-        RangeFilter { roleName: "age"; minimumValue: 18; minimumInclusive: true }
-    }
-}
-

See also FilterContainer.

- -

Property Documentation

- -
-
- - -

-[default] filters : list<Filter>

-

This property holds the list of filters for this filter role. The data of this role will be equal to the true if all its filters match the model row, false otherwise.

-

See also Filter and FilterContainer.

-
-
- -
-
- - -

-name : string

-

This property holds the role name of the proxy role.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter-members.html deleted file mode 100644 index 6a3961a4..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter-members.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - List of All Members for FilterSorter | SortFilterProxyModel - - - - -

List of All Members for FilterSorter

-

This is the complete list of members for FilterSorter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter.html deleted file mode 100644 index 4d495b80..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-filtersorter.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - FilterSorter QML Type | SortFilterProxyModel - - - - -

FilterSorter QML Type

- - -

Sorts rows based on if they match filters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Sorter

-
- -

Properties

- - - -

Detailed Description

-

A FilterSorter is a Sorter that orders row matching its filters before the rows not matching the filters.

-

In the following example, rows with their favorite role set to true will be ordered at the beginning :

-
SortFilterProxyModel {
-    sourceModel: contactModel
-    sorters: FilterSorter {
-        ValueFilter { roleName: "favorite"; value: true }
-    }
-}
-

See also FilterContainer.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the sorter is enabled. A disabled sorter will not change the order of the rows.

-

By default, sorters are enabled.

-
-
- -
-
- - -

-[default] filters : list<Filter>

-

This property holds the list of filters for this filter sorter. If a row match all this FilterSorter's filters, it will be ordered before rows not matching all the filters.

-

See also Filter and FilterContainer.

-
-
- -
-
- - -

-priority : int

-

This property holds the sort priority of this sorter. Sorters with a higher priority are applied first. In case of equal priority, Sorters are ordered by their insertion order.

-

By default, the priority is 0.

-
-
- -
-
- - -

-sortOrder : Qt::SortOrder

-

This property holds the sort order of this sorter.

-
- - -
ConstantDescription
Qt.AscendingOrderThe items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrderThe items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales
-

By default, sorting is in ascending order.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter-members.html deleted file mode 100644 index bc766441..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter-members.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - List of All Members for IndexFilter | SortFilterProxyModel - - - - -

List of All Members for IndexFilter

-

This is the complete list of members for IndexFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter.html deleted file mode 100644 index e88806f0..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-indexfilter.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - IndexFilter QML Type | SortFilterProxyModel - - - - -

IndexFilter QML Type

- - -

Filters rows based on their source index. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Filter

-
- -

Properties

- - - -

Detailed Description

-

An IndexFilter is a filter allowing contents to be filtered based on their source model index.

-

In the following example, only the first row of the source model will be accepted:

-
SortFilterProxyModel {
-   sourceModel: contactModel
-   filters: IndexFilter {
-       maximumIndex: 0
-   }
-}
- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- -
-
- - -

-maximumIndex : int

-

This property holds the maximumIndex of the filter. Rows with a source index higher than maximumIndex will be rejected.

-

If maximumIndex is negative, it is counted from the end of the source model, meaning that:

-
maximumIndex: -1
-

is equivalent to :

-
maximumIndex: sourceModel.count - 1
-

By default, no value is set.

-
-
- -
-
- - -

-minimumIndex : int

-

This property holds the minimumIndex of the filter. Rows with a source index lower than minimumIndex will be rejected.

-

If minimumIndex is negative, it is counted from the end of the source model, meaning that :

-
minimumIndex: -1
-

is equivalent to :

-
minimumIndex: sourceModel.count - 1
-

By default, no value is set.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole-members.html deleted file mode 100644 index f697e9a1..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole-members.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - List of All Members for JoinRole | SortFilterProxyModel - - - - -

List of All Members for JoinRole

-

This is the complete list of members for JoinRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole.html deleted file mode 100644 index 1a17d3f1..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-joinrole.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - JoinRole QML Type | SortFilterProxyModel - - - - -

JoinRole QML Type

- - -

a role made from concatenating other roles. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

SingleRole

-
- -

Properties

- - - -

Detailed Description

-

A JoinRole is a simple ProxyRole that concatenates other roles.

-

In the following example, the fullName role is computed by the concatenation of the firstName role and the lastName role separated by a space :

-
SortFilterProxyModel {
-   sourceModel: contactModel
-   proxyRoles: JoinRole {
-       name: "fullName"
-       roleNames: ["firstName", "lastName"]
-  }
-}
- -

Property Documentation

- -
-
- - -

-name : string

-

This property holds the role name of the proxy role.

-
-
- -
-
- - -

-roleNames : list<string>

-

This property holds the role names that are joined by this role.

-
-
- -
-
- - -

-separator : string

-

This property holds the separator that is used to join the roles specified in roleNames.

-

By default, it's a space.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole-members.html deleted file mode 100644 index c4bb9cb6..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole-members.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - List of All Members for ProxyRole | SortFilterProxyModel - - - - -

List of All Members for ProxyRole

-

This is the complete list of members for ProxyRole, including inherited members.

- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole.html deleted file mode 100644 index 7408f0c9..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-proxyrole.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - ProxyRole QML Type | SortFilterProxyModel - - - - -

ProxyRole QML Type

- - -

Base type for the SortFilterProxyModel proxy roles. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherited By:

RegExpRole and SingleRole

-
- - -

Detailed Description

-

The ProxyRole type cannot be used directly in a QML file. It exists to provide a set of common properties and methods, available across all the other proxy role types that inherit from it. Attempting to use the ProxyRole type directly will result in an error.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter-members.html deleted file mode 100644 index 7898ac61..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter-members.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - List of All Members for RangeFilter | SortFilterProxyModel - - - - -

List of All Members for RangeFilter

-

This is the complete list of members for RangeFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter.html deleted file mode 100644 index 0d431541..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rangefilter.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - RangeFilter QML Type | SortFilterProxyModel - - - - -

RangeFilter QML Type

- - -

Filters rows between boundary values. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

RoleFilter

-
- -

Properties

- - - -

Detailed Description

-

A RangeFilter is a RoleFilter that accepts rows if their data is between the filter's minimum and maximum value.

-

In the following example, only rows with their price role set to a value between the tow boundary of the slider will be accepted :

-
RangeSlider {
-   id: priceRangeSlider
-}
-
-SortFilterProxyModel {
-   sourceModel: priceModel
-   filters: RangeFilter {
-       roleName: "price"
-       minimumValue: priceRangeSlider.first.value
-       maximumValue: priceRangeSlider.second.value
-   }
-}
- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- -
-
- - -

-maximumInclusive : int

-

This property holds whether the minimumValue is inclusive.

-

By default, the minimumValue is inclusive.

-

See also minimumValue.

-
-
- -
-
- - -

-maximumValue : int

-

This property holds the maximumValue of the filter. Rows with a value higher than maximumValue will be rejected.

-

By default, no value is set.

-

See also maximumInclusive.

-
-
- -
-
- - -

-minimumInclusive : int

-

This property holds whether the minimumValue is inclusive.

-

By default, the minimumValue is inclusive.

-

See also minimumValue.

-
-
- -
-
- - -

-minimumValue : int

-

This property holds the minimumValue of the filter. Rows with a value lower than minimumValue will be rejected.

-

By default, no value is set.

-

See also minimumInclusive.

-
-
- -
-
- - -

-roleName : string

-

This property holds the role name that the filter is using to query the source model's data when filtering items.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter-members.html deleted file mode 100644 index c771d0b5..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter-members.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - List of All Members for RegExpFilter | SortFilterProxyModel - - - - -

List of All Members for RegExpFilter

-

This is the complete list of members for RegExpFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter.html deleted file mode 100644 index bd0c9f17..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexpfilter.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - RegExpFilter QML Type | SortFilterProxyModel - - - - -

RegExpFilter QML Type

- - -

Filters rows matching a regular expression. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

RoleFilter

-
- -

Properties

- - - -

Detailed Description

-

A RegExpFilter is a RoleFilter that accepts rows matching a regular rexpression.

-

In the following example, only rows with their lastName role beggining with the content of textfield the will be accepted:

-
TextField {
-   id: nameTextField
-}
-
-SortFilterProxyModel {
-   sourceModel: contactModel
-   filters: RegExpFilter {
-       roleName: "lastName"
-       pattern: "^" + nameTextField.displayText
-   }
-}
- -

Property Documentation

- -
-
- - -

-caseSensitivity : Qt::CaseSensitivity

-

This property holds the caseSensitivity of the filter.

-
-
- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- -
-
- - -

-pattern : bool

-

The pattern used to filter the contents of the source model.

-

See also syntax.

-
-
- -
-
- - -

-roleName : string

-

This property holds the role name that the filter is using to query the source model's data when filtering items.

-
-
- -
-
- - -

-syntax : enum

-

The pattern used to filter the contents of the source model.

-

Only the source model's value having their RoleFilter::roleName data matching this pattern with the specified syntax will be kept.

-
- - - - - - -
ConstantDescription
RegExpFilter.RegExpA rich Perl-like pattern matching syntax. This is the default.
RegExpFilter.WildcardThis provides a simple pattern matching syntax similar to that used by shells (command interpreters) for "file globbing".
RegExpFilter.FixedStringThe pattern is a fixed string. This is equivalent to using the RegExp pattern on a string in which all metacharacters are escaped.
RegExpFilter.RegExp2Like RegExp, but with greedy quantifiers.
RegExpFilter.WildcardUnixThis is similar to Wildcard but with the behavior of a Unix shell. The wildcard characters can be escaped with the character "".
RegExpFilter.W3CXmlSchema11The pattern is a regular expression as defined by the W3C XML Schema 1.1 specification.
-

See also pattern.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole-members.html deleted file mode 100644 index 79a007df..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole-members.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - List of All Members for RegExpRole | SortFilterProxyModel - - - - -

List of All Members for RegExpRole

-

This is the complete list of members for RegExpRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole.html deleted file mode 100644 index 504216fc..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-regexprole.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - RegExpRole QML Type | SortFilterProxyModel - - - - -

RegExpRole QML Type

- - -

A ProxyRole extracting data from a source role via a regular expression. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

ProxyRole

-
- -

Properties

- - - -

Detailed Description

-

A RegExpRole is a ProxyRole that provides a role for each named capture group of its regular expression pattern.

-

In the following example, the date role of the source model will be extracted in 3 roles in the proxy moodel: year, month and day.

-
SortFilterProxyModel {
-    sourceModel: eventModel
-    proxyRoles: RegExpRole {
-        roleName: "date"
-        pattern: "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})"
-    }
-}
- -

Property Documentation

- -
-
- - -

-caseSensitivity : Qt::CaseSensitivity

-

This property holds the caseSensitivity of the regular expression.

-
-
- -
-
- - -

-pattern : QString

-

This property holds the pattern of the regular expression of this RegExpRole. The RegExpRole will expose a role for each of the named capture group of the pattern.

-
-
- -
-
- - -

-roleName : QString

-

This property holds the role name that the RegExpRole is using to query the source model's data to extract new roles from.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter-members.html deleted file mode 100644 index d21124b4..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter-members.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - List of All Members for RoleFilter | SortFilterProxyModel - - - - -

List of All Members for RoleFilter

-

This is the complete list of members for RoleFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter.html deleted file mode 100644 index 86a499d4..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolefilter.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - RoleFilter QML Type | SortFilterProxyModel - - - - -

RoleFilter QML Type

- - -

Base type for filters based on a source model role. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Filter

-
Inherited By:

RangeFilter, RegExpFilter, and ValueFilter

-
- -

Properties

- - - -

Detailed Description

-

The RoleFilter type cannot be used directly in a QML file. It exists to provide a set of common properties and methods, available across all the other filter types that inherit from it. Attempting to use the RoleFilter type directly will result in an error.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- -
-
- - -

-roleName : string

-

This property holds the role name that the filter is using to query the source model's data when filtering items.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter-members.html deleted file mode 100644 index d714d532..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter-members.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - List of All Members for RoleSorter | SortFilterProxyModel - - - - -

List of All Members for RoleSorter

-

This is the complete list of members for RoleSorter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter.html deleted file mode 100644 index 8fed71d1..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-rolesorter.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - RoleSorter QML Type | SortFilterProxyModel - - - - -

RoleSorter QML Type

- - -

Sorts rows based on a source model role. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

Sorter

-
Inherited By:

StringSorter

-
- -

Properties

- - - -

Detailed Description

-

A RoleSorter is a simple Sorter that sorts rows based on a source model role.

-

In the following example, rows with be sorted by their lastName role :

-
SortFilterProxyModel {
-   sourceModel: contactModel
-   sorters: RoleSorter { roleName: "lastName" }
-}
- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the sorter is enabled. A disabled sorter will not change the order of the rows.

-

By default, sorters are enabled.

-
-
- -
-
- - -

-priority : int

-

This property holds the sort priority of this sorter. Sorters with a higher priority are applied first. In case of equal priority, Sorters are ordered by their insertion order.

-

By default, the priority is 0.

-
-
- -
-
- - -

-roleName : string

-

This property holds the role name that the sorter is using to query the source model's data when sorting items.

-
-
- -
-
- - -

-sortOrder : Qt::SortOrder

-

This property holds the sort order of this sorter.

-
- - -
ConstantDescription
Qt.AscendingOrderThe items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrderThe items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales
-

By default, sorting is in ascending order.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole-members.html deleted file mode 100644 index a62df06a..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole-members.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - List of All Members for SingleRole | SortFilterProxyModel - - - - -

List of All Members for SingleRole

-

This is the complete list of members for SingleRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole.html deleted file mode 100644 index e1d8727b..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-singlerole.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - SingleRole QML Type | SortFilterProxyModel - - - - -

SingleRole QML Type

- - -

Base type for the SortFilterProxyModel proxy roles defining a single role. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

ProxyRole

-
Inherited By:

ExpressionRole, FilterRole, JoinRole, and SwitchRole

-
- -

Properties

- - - -

Detailed Description

-

SingleRole is a convenience base class for proxy roles who define a single role. It cannot be used directly in a QML file. It exists to provide a set of common properties and methods, available across all the other proxy role types that inherit from it. Attempting to use the SingleRole type directly will result in an error.

- -

Property Documentation

- -
-
- - -

-name : string

-

This property holds the role name of the proxy role.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter-members.html deleted file mode 100644 index 80328bd2..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter-members.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - List of All Members for Sorter | SortFilterProxyModel - - - - -

List of All Members for Sorter

-

This is the complete list of members for Sorter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter.html deleted file mode 100644 index bbcfe668..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sorter.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - Sorter QML Type | SortFilterProxyModel - - - - -

Sorter QML Type

- - -

Base type for the SortFilterProxyModel sorters. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherited By:

ExpressionSorter, FilterSorter, and RoleSorter

-
- -

Properties

- - - -

Detailed Description

-

The Sorter type cannot be used directly in a QML file. It exists to provide a set of common properties and methods, available across all the other sorters types that inherit from it. Attempting to use the Sorter type directly will result in an error.

- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the sorter is enabled. A disabled sorter will not change the order of the rows.

-

By default, sorters are enabled.

-
-
- -
-
- - -

-priority : int

-

This property holds the sort priority of this sorter. Sorters with a higher priority are applied first. In case of equal priority, Sorters are ordered by their insertion order.

-

By default, the priority is 0.

-
-
- -
-
- - -

-sortOrder : Qt::SortOrder

-

This property holds the sort order of this sorter.

-
- - -
ConstantDescription
Qt.AscendingOrderThe items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrderThe items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales
-

By default, sorting is in ascending order.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer-members.html deleted file mode 100644 index 9b87117f..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer-members.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - List of All Members for SorterContainer | SortFilterProxyModel - - - - -

List of All Members for SorterContainer

-

This is the complete list of members for SorterContainer, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer.html deleted file mode 100644 index b8dff10e..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortercontainer.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - SorterContainer QML Type | SortFilterProxyModel - - - - -

SorterContainer QML Type

- - -

Abstract interface for types containing Sorters. More...

- -
-
Import Statement: import SortFilterProxyModel .
- -

Attached Properties

- - - -

Detailed Description

- -

Types implementing this interface:

-
- -

SortFilterProxyModel

Filters and sorts data coming from a source QAbstractItemModel

- -

Attached Property Documentation

- -
-
- - -

-SorterContainer.container : bool

-

This attached property allows you to include in a SorterContainer a Sorter that has been instantiated outside of the SorterContainer, for example in an Instantiator.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel-members.html deleted file mode 100644 index d44b931c..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel-members.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - List of All Members for SortFilterProxyModel | SortFilterProxyModel - - - - -

List of All Members for SortFilterProxyModel

-

This is the complete list of members for SortFilterProxyModel, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel.html deleted file mode 100644 index b57df588..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-sortfilterproxymodel.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - SortFilterProxyModel QML Type | SortFilterProxyModel - - - - -

SortFilterProxyModel QML Type

- - -

Filters and sorts data coming from a source QAbstractItemModel. More...

- -
-
Import Statement: import SortFilterProxyModel .
- -

Properties

- - -

Methods

- - - -

Detailed Description

-

The SortFilterProxyModel type provides support for filtering and sorting data coming from a source model.

-

See also FilterContainer and SorterContainer.

- -

Property Documentation

- -
-
- - -

-count : int

-

The number of rows in the proxy model (not filtered out the source model)

-
-
- -
-
- - -

-delayed : bool

-

Delay the execution of filters, sorters and proxyRoles until the next event loop. This can be used as an optimization when multiple filters, sorters or proxyRoles are changed in a single event loop. They will be executed once in a single batch at the next event loop instead of being executed in multiple sequential batches.

-

By default, the SortFilterProxyModel is not delayed, unless the SFPM_DELAYED environment variable is defined at compile time.

-
-
- -
-
- - -

-filters : list<Filter>

-

This property holds the list of filters for this proxy model. To be included in the model, a row of the source model has to be accepted by all the top level filters of this list.

-

See also Filter and FilterContainer.

-
-
- -
-
- - -

-proxyRoles : list<ProxyRole>

-

This property holds the list of proxy roles for this proxy model. Each proxy role adds a new custom role to the model.

-

See also ProxyRole.

-
-
- -
-
- - -

-sortRoleName : string

-

The role name of the source model's data used for the sorting.

-

See also sortRole and roleForName.

-
-
- -
-
- - -

-sorters : list<Sorter>

-

This property holds the list of sorters for this proxy model. The rows of the source model are sorted by the sorters of this list, in their order of insertion.

-

See also Sorter and SorterContainer.

-
-
- -
-
- - -

-sourceModel : QAbstractItemModel*

-

The source model of this proxy model

-
-
-

Method Documentation

- -
-
- - -

-variant get(row, string roleName)

-

Return the data for the given roleName of the item at row in the proxy model. This allows the role data to be read (not modified) from JavaScript. This equivalent to calling data(index(row, 0), roleForName(roleName)).

-
-
- -
-
- - -

-object get(row)

-

Return the item at row in the proxy model as a map of all its roles. This allows the item data to be read (not modified) from JavaScript.

-
-
- -
-
- - -

-int mapFromSource(sourceRow)

-

Returns the row in the SortFilterProxyModel given the sourceRow from the source model. Returns -1 if there is no corresponding row.

-
-
- -
-
- - -

-QModelIndex mapFromSource(sourceIndex)

-

Returns the model index in the SortFilterProxyModel given the sourceIndex from the source model.

-
-
- -
-
- - -

-int mapToSource(proxyRow)

-

Returns the source model row corresponding to the given proxyRow from the SortFilterProxyModel. Returns -1 if there is no corresponding row.

-
-
- -
-
- - -

-index mapToSource(proxyIndex)

-

Returns the source model index corresponding to the given proxyIndex from the SortFilterProxyModel.

-
-
- -
-
- - -

-int roleForName(roleName)

-

Returns the role number for the given roleName. If no role is found for this roleName, -1 is returned.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter-members.html deleted file mode 100644 index 0fd29abf..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter-members.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - List of All Members for StringSorter | SortFilterProxyModel - - - - -

List of All Members for StringSorter

-

This is the complete list of members for StringSorter, including inherited members.

- -

The following members are inherited from RoleSorter.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter.html deleted file mode 100644 index 3ab8462a..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-stringsorter.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - StringSorter QML Type | SortFilterProxyModel - - - - -

StringSorter QML Type

- - -

Sorts rows based on a source model string role. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

RoleSorter

-
- -

Properties

- - - -

Detailed Description

-

StringSorter is a specialized RoleSorter that sorts rows based on a source model string role. StringSorter compares strings according to a localized collation algorithm.

-

In the following example, rows with be sorted by their lastName role :

-
SortFilterProxyModel {
-   sourceModel: contactModel
-   sorters: StringSorter { roleName: "lastName" }
-}
- -

Property Documentation

- -
-
- - -

-caseSensitivity : Qt.CaseSensitivity

-

This property holds the case sensitivity of the sorter.

-
-
- -
-
- - -

-ignorePunctation : bool

-

This property holds whether the sorter ignores punctation. if ignorePunctuation is true, punctuation characters and symbols are ignored when determining sort order.

-

Note: This property is not currently supported on Apple platforms or if Qt is configured to not use ICU on Linux.

-
- -
-
- - -

-locale : Locale

-

This property holds the locale of the sorter.

-
-
- -
-
- - -

-numericMode : bool

-

This property holds whether the numeric mode of the sorter is enabled. This will enable proper sorting of numeric digits, so that e.g. 100 sorts after 99. By default this mode is off.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole-members.html deleted file mode 100644 index 755a2ea7..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole-members.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - List of All Members for SwitchRole | SortFilterProxyModel - - - - -

List of All Members for SwitchRole

-

This is the complete list of members for SwitchRole, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole.html deleted file mode 100644 index dc72484a..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-switchrole.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - SwitchRole QML Type | SortFilterProxyModel - - - - -

SwitchRole QML Type

- - -

A role using Filter to conditionnaly compute its data. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

SingleRole

-
- -

Properties

- - -

Attached Properties

- - - -

Detailed Description

-

A SwitchRole is a ProxyRole that computes its data with the help of Filter. Each top level filters specified in the SwitchRole is evaluated on the rows of the model, if a Filter evaluates to true, the data of the SwitchRole for this row will be the one of the attached SwitchRole.value property. If no top level filters evaluate to true, the data will default to the one of the defaultRoleName (or the defaultValue if no defaultRoleName is specified).

-

In the following example, the favoriteOrFirstNameSection role is equal to * if the favorite role of a row is true, otherwise it's the same as the firstName role :

-
SortFilterProxyModel {
-   sourceModel: contactModel
-   proxyRoles: SwitchRole {
-       name: "favoriteOrFirstNameSection"
-       filters: ValueFilter {
-           roleName: "favorite"
-           value: true
-           SwitchRole.value: "*"
-       }
-       defaultRoleName: "firstName"
-    }
-}
-

See also FilterContainer.

- -

Property Documentation

- -
-
- - -

-defaultRoleName : string

-

This property holds the default role name of the role. If no filter match a row, the data of this role will be the data of the role whose name is defaultRoleName.

-
-
- -
-
- - -

-defaultValue : var

-

This property holds the default value of the role. If no filter match a row, and no defaultRoleName is set, the data of this role will be defaultValue.

-
-
- -
-
- - -

-[default] filters : list<Filter>

-

This property holds the list of filters for this proxy role. The data of this role will be equal to the attached SwitchRole.value property of the first filter that matches the model row.

-

See also Filter and FilterContainer.

-
-
- -
-
- - -

-name : string

-

This property holds the role name of the proxy role.

-
-
-

Attached Property Documentation

- -
-
- - -

-SwitchRole.value : var

-

This property attaches a value to a Filter.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter-members.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter-members.html deleted file mode 100644 index 5c2d43e3..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter-members.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - List of All Members for ValueFilter | SortFilterProxyModel - - - - -

List of All Members for ValueFilter

-

This is the complete list of members for ValueFilter, including inherited members.

- - - diff --git a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter.html b/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter.html deleted file mode 100644 index 5681bd64..00000000 --- a/client/3rd/SortFilterProxyModel/docs/qml-sortfilterproxymodel-valuefilter.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - ValueFilter QML Type | SortFilterProxyModel - - - - -

ValueFilter QML Type

- - -

Filters rows matching exactly a value. More...

- -
-
Import Statement: import SortFilterProxyModel .
Inherits:

RoleFilter

-
- -

Properties

- - - -

Detailed Description

-

A ValueFilter is a simple RoleFilter that accepts rows matching exactly the filter's value

-

In the following example, only rows with their favorite role set to true will be accepted when the checkbox is checked :

-
CheckBox {
-   id: showOnlyFavoriteCheckBox
-}
-
-SortFilterProxyModel {
-   sourceModel: contactModel
-   filters: ValueFilter {
-       roleName: "favorite"
-       value: true
-       enabled: showOnlyFavoriteCheckBox.checked
-   }
-}
- -

Property Documentation

- -
-
- - -

-enabled : bool

-

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

-

By default, filters are enabled.

-
-
- -
-
- - -

-inverted : bool

-

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

-

By default, filters are not inverted.

-
-
- -
-
- - -

-roleName : string

-

This property holds the role name that the filter is using to query the source model's data when filtering items.

-
-
- -
-
- - -

-value : variant

-

This property holds the value used to filter the contents of the source model.

-
-
- - diff --git a/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel-qmlmodule.html b/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel-qmlmodule.html deleted file mode 100644 index d0709b56..00000000 --- a/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel-qmlmodule.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - SortFilterProxyModel - - - - - - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

AllOf

Filter container accepting rows accepted by all its child filters

AnyOf

Filter container accepting rows accepted by at least one of its child filters

ExpressionFilter

Filters row with a custom filtering

ExpressionRole

A custom role computed from a javascript expression

ExpressionSorter

Sorts row with a custom javascript expression

Filter

Base type for the SortFilterProxyModel filters

FilterContainer

Abstract interface for types containing Filters

FilterRole

A role resolving to true for rows matching all its filters

FilterSorter

Sorts rows based on if they match filters

IndexFilter

Filters rows based on their source index

JoinRole

Role made from concatenating other roles

ProxyRole

Base type for the SortFilterProxyModel proxy roles

RangeFilter

Filters rows between boundary values

RegExpFilter

Filters rows matching a regular expression

RegExpRole

A ProxyRole extracting data from a source role via a regular expression

RoleFilter

Base type for filters based on a source model role

RoleSorter

Sorts rows based on a source model role

SingleRole

Base type for the SortFilterProxyModel proxy roles defining a single role

SortFilterProxyModel

Filters and sorts data coming from a source QAbstractItemModel

Sorter

Base type for the SortFilterProxyModel sorters

SorterContainer

Abstract interface for types containing Sorters

StringSorter

Sorts rows based on a source model string role

SwitchRole

A role using Filter to conditionnaly compute its data

ValueFilter

Filters rows matching exactly a value

- - diff --git a/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel.index b/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel.index deleted file mode 100644 index b80adc99..00000000 --- a/client/3rd/SortFilterProxyModel/docs/sortfilterproxymodel.index +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client/3rd/SortFilterProxyModel/docs/style/offline.css b/client/3rd/SortFilterProxyModel/docs/style/offline.css deleted file mode 100644 index 13c94270..00000000 --- a/client/3rd/SortFilterProxyModel/docs/style/offline.css +++ /dev/null @@ -1,805 +0,0 @@ -body { - font: normal 400 14px/1.2 Arial; - margin-top: 85px; - font-family: Arial, Helvetica; - text-align: left; - margin-left: 5px; - margin-right: 5px; - background-color: #fff; -} - -p { - line-height: 20px -} - -img { - margin-left: 0px; - max-width: 800px; - height: auto; -} - -.content .border img { - box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5) -} - -.content .border .player { - box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5) -} - -.content .indexboxcont li { - font: normal bold 13px/1 Verdana - } - -.content .normallist li { - font: normal 13px/1 Verdana - } - -.descr { - margin-top: 35px; - margin-bottom: 45px; - margin-left: 5px; - text-align: left; - vertical-align: top; -} - -.name { - max-width: 75%; - font-weight: 100; -} - -tt { - text-align: left -} - -/* ------------ -links ------------ -*/ - -a:link { - color: #007330; - text-decoration: none; - text-align: left; -} - -a.qa-mark:target:before { - content: "***"; - color: #ff0000; -} - -a:hover { - color: #44a51c; - text-align: left; -} - -a:visited { - color: #007330; - text-align: left; -} - -a:visited:hover { - color: #44a51c; - text-align: left; -} - -/* ------------ -offline viewing: HTML links display an icon ------------ -*/ - -a[href*="http://"], a[href*="ftp://"], a[href*="https://"] { - text-decoration: none; - background-image: url(../images/ico_out.png); - background-repeat: no-repeat; - background-position: left; - padding-left: 20px; - text-align: left; -} - -.flags { - text-decoration: none; - text-height: 24px; -} - -.flags:target { - background-color: #FFFFD6; -} - -/* -------------------------------- -NOTE styles -------------------------------- -*/ - -.notetitle, .tiptitle, .fastpathtitle { - font-weight: bold -} - -.attentiontitle, .cautiontitle, .dangertitle, .importanttitle, .remembertitle, .restrictiontitle { - font-weight: bold -} - -.note, .tip, .fastpath { - background: #F2F2F2 url(../images/ico_note.png); - background-repeat: no-repeat; - background-position: top left; - padding: 5px; - padding-left: 40px; - padding-bottom: 10px; - border: #999 1px dotted; - color: #666666; - margin: 5px; -} - -.attention, .caution, .danger, .important, .remember, .restriction { - background: #F2F2F2 url(../images/ico_note_attention.png); - background-repeat: no-repeat; - background-position: top left; - padding: 5px; - padding-left: 40px; - padding-bottom: 10px; - border: #999 1px dotted; - color: #666666; - margin: 5px; -} - -/* -------------------------------- -Top navigation -------------------------------- -*/ - -.qtref { - display: block; - position: relative; - height: 15px; - z-index: 1; - font-size: 11px; - padding-right: 10px; - float: right; -} - -.naviNextPrevious { - clear: both; - display: block; - position: relative; - text-align: right; - top: -47px; - float: right; - height: 20px; - z-index: 1; - padding-right: 10px; - padding-top: 2px; - vertical-align: top; - margin: 0px; -} - -.naviNextPrevious > a:first-child { - background-image: url(../images/btn_prev.png); - background-repeat: no-repeat; - background-position: left; - padding-left: 20px; - height: 20px; - padding-left: 20px; - } - -.naviNextPrevious > a:last-child { - background-image: url(../images/btn_next.png); - background-repeat: no-repeat; - background-position: right; - padding-right: 20px; - height: 20px; - margin-left: 30px; - } - -.naviSeparator { display: none } -/* ------------ -footer and license ------------ -*/ - -.footer { - text-align: left; - padding-top: 45px; - padding-left: 5px; - margin-top: 45px; - margin-bottom: 45px; - font-size: 10px; - border-top: 1px solid #999; -} - -.footer p { - line-height: 14px; - font-size: 11px; - padding: 0; - margin: 0; -} - -.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] { - font-weight: bold; -} - -.footerNavi { - width: auto; - text-align: right; - margin-top: 50px; - z-index: 1; -} - -.navigationbar { - display: block; - position: relative; - top: -20px; - border-top: 1px solid #cecece; - border-bottom: 1px solid #cecece; - background-color: #F2F2F2; - z-index: 1; - height: 20px; - padding-left: 7px; - margin: 0px; - padding-top: 2px; - margin-left: -5px; - margin-right: -5px; -} - -.navigationbar .first { - background: url(../images/home.png); - background-position: left; - background-repeat: no-repeat; - padding-left: 20px; - } - -.navigationbar ul { - margin: 0px; - padding: 0px; - } - - .navigationbar ul li { - list-style-type: none; - padding-top: 2px; - padding-left: 4px; - margin: 0; - height: 20px; - } - -.navigationbar li { - float: left - } - - .navigationbar li a, .navigationbar td a { - display: block; - text-decoration: none; - background: url(../images/arrow_bc.png); - background-repeat: no-repeat; - background-position: right; - padding-right: 17px; - } - -table.buildversion { - float: right; - margin-top: -18px !important; -} - -.navigationbar table { - border-radius: 0; - border: 0 none; - background-color: #F2F2F2; - margin: 0; -} - -.navigationbar table td { - padding: 0; - border: 0 none; -} - -#buildversion { - font-style: italic; - font-size: small; - float: right; - margin-right: 5px; -} - -/* - -/* table of content -no display -*/ - -/* ------------ -headers ------------ -*/ - -@media screen { - .title { - color: #313131; - font-size: 24px; - font-weight: normal; - left: 0; - padding-bottom: 20px; - padding-left: 10px; - padding-top: 20px; - position: absolute; - right: 0; - top: 0; - background-color: #E6E6E6; - border-bottom: 1px #CCC solid; - border-top: 2px #CCC solid; - font-weight: bold; - margin-left: 0px; - margin-right: 0px; - } - .subtitle, .small-subtitle { - display: block; - clear: left; - } -} - -h1 { - margin: 0 -} - -h2, p.h2 { - font: 500 16px/1.2 Arial; - font-weight: 100; - background-color: #F2F3F4; - padding: 4px; - margin-bottom: 30px; - margin-top: 30px; - border-top: #E0E0DE 1px solid; - border-bottom: #E0E0DE 1px solid; - max-width: 99%; -} - -h2:target { - background-color: #F2F3D4; -} - -h3 { - font: 500 14px/1.2 Arial; - font-weight: 100; - text-decoration: underline; - margin-bottom: 30px; - margin-top: 30px; -} - -h3.fn, span.fn { - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - word-spacing: 3px; - padding: 5px 5px; - text-decoration: none; - font-weight: bold; - max-width: 75%; - font-size: 14px; - margin: 0px; - margin-top: 45px; -} -.fngroup h3.fngroupitem { - margin-bottom: 5px; -} -h3.fn code { - float: right; -} -h3.fn:target { - background-color: #F6F6D6; -} - -.name { - color: #1A1A1A -} - -.type { - color: #808080 -} - -@media print { - .title { - color: #0066CB; - font-family: Arial, Helvetica; - font-size: 32px; - font-weight: normal; - left: 0; - position: absolute; - right: 0; - top: 0; - } -} - -/* ------------------ -table styles ------------------ -*/ - -.table img { - border: none; - margin-left: 0px; - -moz-box-shadow: 0px 0px 0px #fff; - -webkit-box-shadow: 0px 0px 0px #fff; - box-shadow: 0px 0px 0px #fff; -} - -/* table with border alternative colours*/ - -table, pre, .LegaleseLeft { - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - margin-bottom: 25px; - margin-left: 15px; - font-size: 12px; - line-height: 1.2; -} - - table tr.even { - background-color: white; - color: #66666E; - } - - table tr.odd { - background-color: #F6F6F6; - color: #66666E; - } - - table tr:target { - background-color: #F6F6D6; - } - - table thead { - text-align: left; - padding-left: 20px; - background-color: #e1e0e0; - border-left: none; - border-right: none; - } - - table thead th { - padding-top: 5px; - padding-left: 10px; - padding-bottom: 5px; - border-bottom: 2px solid #D1D1D1; - padding-right: 10px; - } - - table th { - text-align: left; - padding-left: 20px; - } - - table td { - padding: 3px 15px 3px 20px; - border-bottom: #CCC dotted 1px; - } - - table p { - margin: 0px - } - -.LegaleseLeft { - font-family: monospace; - white-space: pre-wrap; -} -/* table bodless & white*/ - -.borderless { - border-radius: 0px 0px 0px 0px; - background-color: #fff; - border: 1px solid #fff; -} - -.borderless tr { - background-color: #FFF; - color: #66666E; - } - -.borderless td { - border: none; - border-bottom: #fff dotted 1px; - } - -/* ------------ -List ------------ -*/ - -ul { - margin-top: 10px; -} - -li { - margin-bottom: 10px; - padding-left: 8px; - list-style: outside; - text-align: left; -} - - ul > li { - list-style-type: square; - } - -ol { - margin: 10px; - padding: 0; -} - -ol.A > li { - list-style-type: upper-alpha; -} - -ol.a > li{ - list-style-type: lower-alpha; -} - - ol > li { - margin-left: 30px; - padding-left: 8px; - list-style: decimal; - } - -.centerAlign { - text-align: left -} - -.cpp, .LegaleseLeft { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.js { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.memItemLeft { - padding-right: 3px -} - -.memItemRight { - padding: 3px 15px 3px 0 -} - -.qml { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.qmldefault { - padding-left: 5px; - float: right; - color: red; -} - -.qmlreadonly { - padding-left: 5px; - float: right; - color: #254117; -} - -.rightAlign { - padding: 3px 5px 3px 10px; - text-align: right; -} - -.qmldoc { - margin-left: 15px -} - -.flowList { - padding: 25px -} -.flowList dd { - display: inline-block; - margin-left: 10px; - width: 255px; - line-height: 1.15em; - overflow-x: hidden; - text-overflow: ellipsis -} -.alphaChar { - font-size: 2em; - position: relative -} -/* ------------ -Content table ------------ -*/ - -@media print { - .toc { - float: right; - clear: right; - padding-bottom: 10px; - padding-top: 50px; - width: 100%; - background-image: url(../images/bgrContent.png); - background-position: top; - background-repeat: no-repeat; - } -} - -@media screen { - .toc { - float: right; - clear: right; - vertical-align: top; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background: #FFF url('../images/bgrContent.png'); - background-position: top; - background-repeat: repeat-x; - border: 1px solid #E6E6E6; - padding-left: 5px; - padding-bottom: 10px; - height: auto; - width: 200px; - text-align: left; - margin-left: 20px; - } -} - - -.toc h3 { - text-decoration: none -} - -.toc h3 { - font: 500 14px/1.2 Arial; - font-weight: 100; - padding: 0px; - margin: 0px; - padding-top: 5px; - padding-left: 5px; -} - -.toc ul { - padding-left: 10px; - padding-right: 5px; -} - -.toc ul li { - margin-left: 15px; - list-style-image: url(../images/bullet_dn.png); - marker-offset: 0px; - margin-bottom: 8px; - padding-left: 0px; - } - -.toc .level1 { - border: none -} - -.toc .level2 { - border: none; - margin-left: 25px; -} - -.level3 { - border: none; - margin-left: 30px; -} - -.clearfix { - clear: both -} - -/* ------------ -Landing page ------------ -*/ - -.col-group { - white-space: nowrap; - vertical-align: top; -} - - -.landing h2 { - background-color: transparent; - border: none; - margin-bottom: 0px; - font-size: 18px; -} - -.landing a, .landing li { - font-size: 13px; - font-weight: bold !important; -} - -.col-1 { - display: inline-block; - white-space: normal; - width: 70%; - height: 100%; - float: left; -} - -.col-2 { - display: inline-block; - white-space: normal; - width: 20%; - margin-left: 5%; - position: relative; - top: -20px; -} - -.col-1 h1 { - margin: 20px 0 0 0; - } - -.col-1 h2 { - font-size: 18px; - font-weight: bold !important; -} - -.landingicons { - display: inline-block; - width: 100%; -} - -.icons1of3 { - display: inline-block; - width: 33.3333%; - float: left; -} - -.icons1of3 h2, .doc-column h2 { - font-size: 15px; - margin: 0px; - padding: 0px; -} - -div.multi-column { - position: relative; -} - -div.multi-column div { - display: -moz-inline-box; - display: inline-block; - vertical-align: top; - margin-top: 1em; - margin-right: 4em; - width: 24em; -} - -.mainContent .video { - width:40%; - max-width:640px; - margin: 15px 0 0 15px; - position:relative; - display:table -} - -.mainContent .video > .vspan { - padding-top:60%; - display:block -} -.mainContent .video iframe { - width:100%; - height:100%; - position:absolute; - top:0; - left:0 -} diff --git a/client/3rd/SortFilterProxyModel/filters/alloffilter.cpp b/client/3rd/SortFilterProxyModel/filters/alloffilter.cpp deleted file mode 100644 index 9b3d2d72..00000000 --- a/client/3rd/SortFilterProxyModel/filters/alloffilter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "alloffilter.h" - -namespace qqsfpm { - -/*! - \qmltype AllOf - \inherits Filter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \ingroup FilterContainer - \brief Filter container accepting rows accepted by all its child filters. - - The AllOf type is a \l Filter container that accepts rows if all of its contained (and enabled) filters accept them, or if it has no filter. - - Using it as a top level filter has the same effect as putting all its child filters as top level filters. It can however be usefull to use an AllOf filter when nested in an AnyOf filter. - \sa FilterContainer -*/ -bool AllOfFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - //return true if all filters return false, or if there is no filter. - return std::all_of(m_filters.begin(), m_filters.end(), - [&sourceIndex, &proxyModel] (Filter* filter) { - return filter->filterAcceptsRow(sourceIndex, proxyModel); - } - ); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/alloffilter.h b/client/3rd/SortFilterProxyModel/filters/alloffilter.h deleted file mode 100644 index 14b5baec..00000000 --- a/client/3rd/SortFilterProxyModel/filters/alloffilter.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ALLOFFILTER_H -#define ALLOFFILTER_H - -#include "filtercontainerfilter.h" - -namespace qqsfpm { - -class AllOfFilter : public FilterContainerFilter { - Q_OBJECT - -public: - using FilterContainerFilter::FilterContainerFilter; - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; -}; - -} - -#endif // ALLOFFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/anyoffilter.cpp b/client/3rd/SortFilterProxyModel/filters/anyoffilter.cpp deleted file mode 100644 index 4cfe9b80..00000000 --- a/client/3rd/SortFilterProxyModel/filters/anyoffilter.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "anyoffilter.h" - -namespace qqsfpm { - -/*! - \qmltype AnyOf - \inherits Filter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \ingroup FilterContainer - \brief Filter container accepting rows accepted by at least one of its child filters. - - The AnyOf type is a \l Filter container that accepts rows if any of its contained (and enabled) filters accept them. - - In the following example, only the rows where the \c firstName role or the \c lastName role match the text entered in the \c nameTextField will be accepted : - \code - TextField { - id: nameTextField - } - - SortFilterProxyModel { - sourceModel: contactModel - filters: AnyOf { - RegExpFilter { - roleName: "lastName" - pattern: nameTextField.text - caseSensitivity: Qt.CaseInsensitive - } - RegExpFilter { - roleName: "firstName" - pattern: nameTextField.text - caseSensitivity: Qt.CaseInsensitive - } - } - } - \endcode - \sa FilterContainer -*/ -bool AnyOfFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - //return true if any of the enabled filters return true - return std::any_of(m_filters.begin(), m_filters.end(), - [&sourceIndex, &proxyModel] (Filter* filter) { - return filter->enabled() && filter->filterAcceptsRow(sourceIndex, proxyModel); - } - ); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/anyoffilter.h b/client/3rd/SortFilterProxyModel/filters/anyoffilter.h deleted file mode 100644 index b3bb6f53..00000000 --- a/client/3rd/SortFilterProxyModel/filters/anyoffilter.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ANYOFFILTER_H -#define ANYOFFILTER_H - -#include "filtercontainerfilter.h" - -namespace qqsfpm { - -class AnyOfFilter : public FilterContainerFilter { - Q_OBJECT - -public: - using FilterContainerFilter::FilterContainerFilter; - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; -}; - -} - -#endif // ANYOFFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/expressionfilter.cpp b/client/3rd/SortFilterProxyModel/filters/expressionfilter.cpp deleted file mode 100644 index f3673ce1..00000000 --- a/client/3rd/SortFilterProxyModel/filters/expressionfilter.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include "expressionfilter.h" -#include "qqmlsortfilterproxymodel.h" -#include - -namespace qqsfpm { - -/*! - \qmltype ExpressionFilter - \inherits Filter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Filters row with a custom filtering. - - An ExpressionFilter is a \l Filter allowing to implement custom filtering based on a javascript expression. -*/ - -/*! - \qmlproperty expression ExpressionFilter::expression - - An expression to implement custom filtering, it must evaluate to a boolean. - It has the same syntax has a \l {http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html} {Property Binding} except it will be evaluated for each of the source model's rows. - Rows that have their expression evaluating to \c true will be accepted by the model. - Data for each row is exposed like for a delegate of a QML View. - - This expression is reevaluated for a row every time its model data changes. - When an external property (not \c index or in \c model) the expression depends on changes, the expression is reevaluated for every row of the source model. - To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. - This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes. - - A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression. -*/ -const QQmlScriptString& ExpressionFilter::expression() const -{ - return m_scriptString; -} - -void ExpressionFilter::setExpression(const QQmlScriptString& scriptString) -{ - if (m_scriptString == scriptString) - return; - - m_scriptString = scriptString; - updateExpression(); - - Q_EMIT expressionChanged(); - invalidate(); -} - -void ExpressionFilter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - updateContext(proxyModel); -} - -bool ExpressionFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - if (!m_scriptString.isEmpty()) { - QVariantMap modelMap; - QHash roles = proxyModel.roleNames(); - - QQmlContext context(qmlContext(this)); - auto addToContext = [&] (const QString &name, const QVariant& value) { - context.setContextProperty(name, value); - modelMap.insert(name, value); - }; - - for (auto it = roles.cbegin(); it != roles.cend(); ++it) - addToContext(it.value(), proxyModel.sourceData(sourceIndex, it.key())); - addToContext("index", sourceIndex.row()); - - context.setContextProperty("model", modelMap); - - QQmlExpression expression(m_scriptString, &context); - QVariant variantResult = expression.evaluate(); - - if (expression.hasError()) { - qWarning() << expression.error(); - return true; - } - if (variantResult.canConvert()) { - return variantResult.toBool(); - } else { - qWarning("%s:%i:%i : Can't convert result to bool", - expression.sourceFile().toUtf8().data(), - expression.lineNumber(), - expression.columnNumber()); - return true; - } - } - return true; -} - -void ExpressionFilter::updateContext(const QQmlSortFilterProxyModel& proxyModel) -{ - delete m_context; - m_context = new QQmlContext(qmlContext(this), this); - // what about roles changes ? - QVariantMap modelMap; - - auto addToContext = [&] (const QString &name, const QVariant& value) { - m_context->setContextProperty(name, value); - modelMap.insert(name, value); - }; - - for (const QByteArray& roleName : proxyModel.roleNames().values()) - addToContext(roleName, QVariant()); - - addToContext("index", -1); - - m_context->setContextProperty("model", modelMap); - updateExpression(); -} - -void ExpressionFilter::updateExpression() -{ - if (!m_context) - return; - - delete m_expression; - m_expression = new QQmlExpression(m_scriptString, m_context, 0, this); - connect(m_expression, &QQmlExpression::valueChanged, this, &ExpressionFilter::invalidate); - m_expression->setNotifyOnValueChanged(true); - m_expression->evaluate(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/expressionfilter.h b/client/3rd/SortFilterProxyModel/filters/expressionfilter.h deleted file mode 100644 index fe7da4aa..00000000 --- a/client/3rd/SortFilterProxyModel/filters/expressionfilter.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef EXPRESSIONFILTER_H -#define EXPRESSIONFILTER_H - -#include "filter.h" -#include - -class QQmlExpression; - -namespace qqsfpm { - -class ExpressionFilter : public Filter -{ - Q_OBJECT - Q_PROPERTY(QQmlScriptString expression READ expression WRITE setExpression NOTIFY expressionChanged) - -public: - using Filter::Filter; - - const QQmlScriptString& expression() const; - void setExpression(const QQmlScriptString& scriptString); - - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; - -Q_SIGNALS: - void expressionChanged(); - -private: - void updateContext(const QQmlSortFilterProxyModel& proxyModel); - void updateExpression(); - - QQmlScriptString m_scriptString; - QQmlExpression* m_expression = nullptr; - QQmlContext* m_context = nullptr; -}; - -} - -#endif // EXPRESSIONFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/filter.cpp b/client/3rd/SortFilterProxyModel/filters/filter.cpp deleted file mode 100644 index 1e46da7e..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filter.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "filter.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype Filter - \qmlabstract - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Base type for the \l SortFilterProxyModel filters. - - The Filter type cannot be used directly in a QML file. - It exists to provide a set of common properties and methods, - available across all the other filter types that inherit from it. - Attempting to use the Filter type directly will result in an error. -*/ - -Filter::Filter(QObject *parent) : QObject(parent) -{ -} - -/*! - \qmlproperty bool Filter::enabled - - This property holds whether the filter is enabled. - A disabled filter will accept every rows unconditionally (even if it's inverted). - - By default, filters are enabled. -*/ -bool Filter::enabled() const -{ - return m_enabled; -} - -void Filter::setEnabled(bool enabled) -{ - if (m_enabled == enabled) - return; - - m_enabled = enabled; - Q_EMIT enabledChanged(); - Q_EMIT invalidated(); -} - -/*! - \qmlproperty bool Filter::inverted - - This property holds whether the filter is inverted. - When a filter is inverted, a row normally accepted would be rejected, and vice-versa. - - By default, filters are not inverted. -*/ -bool Filter::inverted() const -{ - return m_inverted; -} - -void Filter::setInverted(bool inverted) -{ - if (m_inverted == inverted) - return; - - m_inverted = inverted; - Q_EMIT invertedChanged(); - invalidate(); -} - -bool Filter::filterAcceptsRow(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - return !m_enabled || filterRow(sourceIndex, proxyModel) ^ m_inverted; -} - -void Filter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - Q_UNUSED(proxyModel) -} - -void Filter::invalidate() -{ - if (m_enabled) - Q_EMIT invalidated(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/filter.h b/client/3rd/SortFilterProxyModel/filters/filter.h deleted file mode 100644 index c88dec34..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filter.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef FILTER_H -#define FILTER_H - -#include - -namespace qqsfpm { - -class QQmlSortFilterProxyModel; - -class Filter : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged) - -public: - explicit Filter(QObject *parent = nullptr); - virtual ~Filter() = default; - - bool enabled() const; - void setEnabled(bool enabled); - - bool inverted() const; - void setInverted(bool inverted); - - bool filterAcceptsRow(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const; - - virtual void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel); - -Q_SIGNALS: - void enabledChanged(); - void invertedChanged(); - void invalidated(); - -protected: - virtual bool filterRow(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const = 0; - void invalidate(); - -private: - bool m_enabled = true; - bool m_inverted = false; -}; - -} - -#endif // FILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/filtercontainer.cpp b/client/3rd/SortFilterProxyModel/filters/filtercontainer.cpp deleted file mode 100644 index ad955e14..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filtercontainer.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "filtercontainer.h" -#include "filter.h" -#include - -namespace qqsfpm { - -/*! - \qmltype FilterContainer - \qmlabstract - \inqmlmodule SortFilterProxyModel - \ingroup FilterAttached - \brief Abstract interface for types containing \l {Filter}{Filters}. - - \section2 Types implementing this interface: - \annotatedlist FilterContainer -*/ - -QList FilterContainer::filters() const -{ - return m_filters; -} - -void FilterContainer::appendFilter(Filter* filter) -{ - m_filters.append(filter); - onFilterAppended(filter); -} - -void FilterContainer::removeFilter(Filter* filter) -{ - m_filters.removeOne(filter); - onFilterRemoved(filter); -} - -void FilterContainer::clearFilters() -{ - m_filters.clear(); - onFiltersCleared(); -} - -QQmlListProperty FilterContainer::filtersListProperty() -{ - return QQmlListProperty(reinterpret_cast(this), &m_filters, - &FilterContainer::append_filter, - &FilterContainer::count_filter, - &FilterContainer::at_filter, - &FilterContainer::clear_filters); -} - -void FilterContainer::append_filter(QQmlListProperty* list, Filter* filter) -{ - if (!filter) - return; - - FilterContainer* that = reinterpret_cast(list->object); - that->appendFilter(filter); -} - -qsizetype FilterContainer::count_filter(QQmlListProperty* list) -{ - QList* filters = static_cast*>(list->data); - return filters->count(); -} - -Filter* FilterContainer::at_filter(QQmlListProperty* list, qsizetype index) -{ - QList* filters = static_cast*>(list->data); - return filters->at(index); -} - -void FilterContainer::clear_filters(QQmlListProperty *list) -{ - FilterContainer* that = reinterpret_cast(list->object); - that->clearFilters(); -} - -FilterContainerAttached::FilterContainerAttached(QObject* object) : QObject(object), - m_filter(qobject_cast(object)) -{ - if (!m_filter) - qmlWarning(object) << "FilterContainer must be attached to a Filter"; -} - -FilterContainerAttached::~FilterContainerAttached() -{ - if (m_filter && m_container) { - FilterContainer* container = qobject_cast(m_container.data()); - container->removeFilter(m_filter); - } -} - -/*! - \qmlattachedproperty bool FilterContainer::container - This attached property allows you to include in a \l FilterContainer a \l Filter that - has been instantiated outside of the \l FilterContainer, for example in an Instantiator. -*/ -QObject* FilterContainerAttached::container() const -{ - return m_container; -} - -void FilterContainerAttached::setContainer(QObject* object) -{ - if (m_container == object) - return; - - FilterContainer* container = qobject_cast(object); - if (object && !container) - qmlWarning(parent()) << "container must inherits from FilterContainer, " << object->metaObject()->className() << " provided"; - - if (m_container && m_filter) - qobject_cast(m_container.data())->removeFilter(m_filter); - - m_container = container ? object : nullptr; - if (container && m_filter) - container->appendFilter(m_filter); - - Q_EMIT containerChanged(); -} - -FilterContainerAttached* FilterContainerAttached::qmlAttachedProperties(QObject* object) -{ - return new FilterContainerAttached(object); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/filtercontainer.h b/client/3rd/SortFilterProxyModel/filters/filtercontainer.h deleted file mode 100644 index 9adf41fa..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filtercontainer.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef FILTERCONTAINER_H -#define FILTERCONTAINER_H - -#include -#include -#include -#include - -namespace qqsfpm { - -class Filter; -class QQmlSortFilterProxyModel; - -class FilterContainer { -public: - virtual ~FilterContainer() = default; - - QList filters() const; - void appendFilter(Filter* filter); - void removeFilter(Filter* filter); - void clearFilters(); - - QQmlListProperty filtersListProperty(); - -protected: - QList m_filters; - -private: - virtual void onFilterAppended(Filter* filter) = 0; - virtual void onFilterRemoved(Filter* filter) = 0; - virtual void onFiltersCleared() = 0; - - static void append_filter(QQmlListProperty* list, Filter* filter); - static qsizetype count_filter(QQmlListProperty* list); - static Filter* at_filter(QQmlListProperty* list, qsizetype index); - static void clear_filters(QQmlListProperty* list); -}; - -class FilterContainerAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QObject* container READ container WRITE setContainer NOTIFY containerChanged) - -public: - FilterContainerAttached(QObject* object); - ~FilterContainerAttached(); - - QObject* container() const; - void setContainer(QObject* object); - - static FilterContainerAttached* qmlAttachedProperties(QObject* object); - -Q_SIGNALS: - void containerChanged(); - -private: - QPointer m_container = nullptr; - Filter* m_filter = nullptr; -}; - -} - -#define FilterContainer_iid "fr.grecko.SortFilterProxyModel.FilterContainer" -Q_DECLARE_INTERFACE(qqsfpm::FilterContainer, FilterContainer_iid) - -QML_DECLARE_TYPEINFO(qqsfpm::FilterContainerAttached, QML_HAS_ATTACHED_PROPERTIES) - -#endif // FILTERCONTAINER_H diff --git a/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.cpp b/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.cpp deleted file mode 100644 index a847e977..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "filtercontainerfilter.h" - -namespace qqsfpm { - -void FilterContainerFilter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - for (Filter* filter : m_filters) - filter->proxyModelCompleted(proxyModel); -} - -void FilterContainerFilter::onFilterAppended(Filter* filter) -{ - connect(filter, &Filter::invalidated, this, &FilterContainerFilter::invalidate); - invalidate(); -} - -void FilterContainerFilter::onFilterRemoved(Filter* filter) -{ - Q_UNUSED(filter) - invalidate(); -} - -void qqsfpm::FilterContainerFilter::onFiltersCleared() -{ - invalidate(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.h b/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.h deleted file mode 100644 index 1aa15fb6..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filtercontainerfilter.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef FILTERCONTAINERFILTER_H -#define FILTERCONTAINERFILTER_H - -#include "filter.h" -#include "filtercontainer.h" - -namespace qqsfpm { - -class FilterContainerFilter : public Filter, public FilterContainer { - Q_OBJECT - Q_INTERFACES(qqsfpm::FilterContainer) - Q_PROPERTY(QQmlListProperty filters READ filtersListProperty NOTIFY filtersChanged) - Q_CLASSINFO("DefaultProperty", "filters") - -public: - using Filter::Filter; - - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - -Q_SIGNALS: - void filtersChanged(); - -private: - void onFilterAppended(Filter* filter) override; - void onFilterRemoved(Filter* filter) override; - void onFiltersCleared() override; -}; - -} - -#endif // FILTERCONTAINERFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/filtersqmltypes.cpp b/client/3rd/SortFilterProxyModel/filters/filtersqmltypes.cpp deleted file mode 100644 index 6704472b..00000000 --- a/client/3rd/SortFilterProxyModel/filters/filtersqmltypes.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "filter.h" -#include "valuefilter.h" -#include "indexfilter.h" -#include "regexpfilter.h" -#include "rangefilter.h" -#include "expressionfilter.h" -#include "anyoffilter.h" -#include "alloffilter.h" -#include -#include - -namespace qqsfpm { - -void registerFiltersTypes() { - qmlRegisterUncreatableType("SortFilterProxyModel", 0, 2, "Filter", "Filter is an abstract class"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "ValueFilter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "IndexFilter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "RegExpFilter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "RangeFilter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "ExpressionFilter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "AnyOf"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "AllOf"); - qmlRegisterUncreatableType("SortFilterProxyModel", 0, 2, "FilterContainer", "FilterContainer can only be used as an attaching type"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerFiltersTypes) - -} diff --git a/client/3rd/SortFilterProxyModel/filters/indexfilter.cpp b/client/3rd/SortFilterProxyModel/filters/indexfilter.cpp deleted file mode 100644 index c1e4b243..00000000 --- a/client/3rd/SortFilterProxyModel/filters/indexfilter.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "indexfilter.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype IndexFilter - \inherits Filter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Filters rows based on their source index. - - An IndexFilter is a filter allowing contents to be filtered based on their source model index. - - In the following example, only the first row of the source model will be accepted: - \code - SortFilterProxyModel { - sourceModel: contactModel - filters: IndexFilter { - maximumIndex: 0 - } - } - \endcode -*/ - -/*! - \qmlproperty int IndexFilter::minimumIndex - - This property holds the minimumIndex of the filter. - Rows with a source index lower than \c minimumIndex will be rejected. - - If \c minimumIndex is negative, it is counted from the end of the source model, meaning that : - \code - minimumIndex: -1 - \endcode - is equivalent to : - \code - minimumIndex: sourceModel.count - 1 - \endcode - By default, no value is set. -*/ -const QVariant& IndexFilter::minimumIndex() const -{ - return m_minimumIndex; -} - -void IndexFilter::setMinimumIndex(const QVariant& minimumIndex) -{ - if (m_minimumIndex == minimumIndex) - return; - - m_minimumIndex = minimumIndex; - Q_EMIT minimumIndexChanged(); - invalidate(); -} - -/*! - \qmlproperty int IndexFilter::maximumIndex - - This property holds the maximumIndex of the filter. - Rows with a source index higher than \c maximumIndex will be rejected. - - If \c maximumIndex is negative, it is counted from the end of the source model, meaning that: - \code - maximumIndex: -1 - \endcode - is equivalent to : - \code - maximumIndex: sourceModel.count - 1 - \endcode - By default, no value is set. -*/ -const QVariant& IndexFilter::maximumIndex() const -{ - return m_maximumIndex; -} - -void IndexFilter::setMaximumIndex(const QVariant& maximumIndex) -{ - if (m_maximumIndex == maximumIndex) - return; - - m_maximumIndex = maximumIndex; - Q_EMIT maximumIndexChanged(); - invalidate(); -} - -bool IndexFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - int sourceRowCount = proxyModel.sourceModel()->rowCount(); - int sourceRow = sourceIndex.row(); - - bool minimumIsValid; - int minimum = m_minimumIndex.toInt(&minimumIsValid); - if (minimumIsValid) { - int actualMinimum = minimum < 0 ? sourceRowCount + minimum : minimum; - if (sourceRow < actualMinimum) - return false; - } - - bool maximumIsValid; - int maximum = m_maximumIndex.toInt(&maximumIsValid); - if (maximumIsValid) { - int actualMaximum = maximum < 0 ? sourceRowCount + maximum : maximum; - if (sourceRow > actualMaximum) - return false; - } - - return true; -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/indexfilter.h b/client/3rd/SortFilterProxyModel/filters/indexfilter.h deleted file mode 100644 index d693a9bf..00000000 --- a/client/3rd/SortFilterProxyModel/filters/indexfilter.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef INDEXFILTER_H -#define INDEXFILTER_H - -#include "filter.h" -#include - -namespace qqsfpm { - -class IndexFilter: public Filter { - Q_OBJECT - Q_PROPERTY(QVariant minimumIndex READ minimumIndex WRITE setMinimumIndex NOTIFY minimumIndexChanged) - Q_PROPERTY(QVariant maximumIndex READ maximumIndex WRITE setMaximumIndex NOTIFY maximumIndexChanged) - -public: - using Filter::Filter; - - const QVariant& minimumIndex() const; - void setMinimumIndex(const QVariant& minimumIndex); - - const QVariant& maximumIndex() const; - void setMaximumIndex(const QVariant& maximumIndex); - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; - -Q_SIGNALS: - void minimumIndexChanged(); - void maximumIndexChanged(); - -private: - QVariant m_minimumIndex; - QVariant m_maximumIndex; -}; - -} - -#endif // INDEXFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/rangefilter.cpp b/client/3rd/SortFilterProxyModel/filters/rangefilter.cpp deleted file mode 100644 index b36adba6..00000000 --- a/client/3rd/SortFilterProxyModel/filters/rangefilter.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "rangefilter.h" -#include "../utils/utils.h" - -namespace qqsfpm { - -/*! - \qmltype RangeFilter - \inherits RoleFilter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Filters rows between boundary values. - - A RangeFilter is a \l RoleFilter that accepts rows if their data is between the filter's minimum and maximum value. - - In the following example, only rows with their \c price role set to a value between the tow boundary of the slider will be accepted : - \code - RangeSlider { - id: priceRangeSlider - } - - SortFilterProxyModel { - sourceModel: priceModel - filters: RangeFilter { - roleName: "price" - minimumValue: priceRangeSlider.first.value - maximumValue: priceRangeSlider.second.value - } - } - \endcode -*/ - -/*! - \qmlproperty int RangeFilter::minimumValue - - This property holds the minimumValue of the filter. - Rows with a value lower than \c minimumValue will be rejected. - - By default, no value is set. - - \sa minimumInclusive -*/ -QVariant RangeFilter::minimumValue() const -{ - return m_minimumValue; -} - -void RangeFilter::setMinimumValue(QVariant minimumValue) -{ - if (m_minimumValue == minimumValue) - return; - - m_minimumValue = minimumValue; - Q_EMIT minimumValueChanged(); - invalidate(); -} - -/*! - \qmlproperty int RangeFilter::minimumInclusive - - This property holds whether the \l minimumValue is inclusive. - - By default, the \l minimumValue is inclusive. - - \sa minimumValue -*/ -bool RangeFilter::minimumInclusive() const -{ - return m_minimumInclusive; -} - -void RangeFilter::setMinimumInclusive(bool minimumInclusive) -{ - if (m_minimumInclusive == minimumInclusive) - return; - - m_minimumInclusive = minimumInclusive; - Q_EMIT minimumInclusiveChanged(); - invalidate(); -} - -/*! - \qmlproperty int RangeFilter::maximumValue - - This property holds the maximumValue of the filter. - Rows with a value higher than \c maximumValue will be rejected. - - By default, no value is set. - - \sa maximumInclusive -*/ -QVariant RangeFilter::maximumValue() const -{ - return m_maximumValue; -} - -void RangeFilter::setMaximumValue(QVariant maximumValue) -{ - if (m_maximumValue == maximumValue) - return; - - m_maximumValue = maximumValue; - Q_EMIT maximumValueChanged(); - invalidate(); -} - -/*! - \qmlproperty int RangeFilter::maximumInclusive - - This property holds whether the \l minimumValue is inclusive. - - By default, the \l minimumValue is inclusive. - - \sa minimumValue -*/ -bool RangeFilter::maximumInclusive() const -{ - return m_maximumInclusive; -} - -void RangeFilter::setMaximumInclusive(bool maximumInclusive) -{ - if (m_maximumInclusive == maximumInclusive) - return; - - m_maximumInclusive = maximumInclusive; - Q_EMIT maximumInclusiveChanged(); - invalidate(); -} - -bool RangeFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - const QVariant value = sourceData(sourceIndex, proxyModel); - bool lessThanMin = m_minimumValue.isValid() && - (m_minimumInclusive ? value < m_minimumValue : value <= m_minimumValue); - bool moreThanMax = m_maximumValue.isValid() && - (m_maximumInclusive ? value > m_maximumValue : value >= m_maximumValue); - return !(lessThanMin || moreThanMax); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/rangefilter.h b/client/3rd/SortFilterProxyModel/filters/rangefilter.h deleted file mode 100644 index 2de2f8ca..00000000 --- a/client/3rd/SortFilterProxyModel/filters/rangefilter.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef RANGEFILTER_H -#define RANGEFILTER_H - -#include "rolefilter.h" -#include - -namespace qqsfpm { - -class RangeFilter : public RoleFilter -{ - Q_OBJECT - Q_PROPERTY(QVariant minimumValue READ minimumValue WRITE setMinimumValue NOTIFY minimumValueChanged) - Q_PROPERTY(bool minimumInclusive READ minimumInclusive WRITE setMinimumInclusive NOTIFY minimumInclusiveChanged) - Q_PROPERTY(QVariant maximumValue READ maximumValue WRITE setMaximumValue NOTIFY maximumValueChanged) - Q_PROPERTY(bool maximumInclusive READ maximumInclusive WRITE setMaximumInclusive NOTIFY maximumInclusiveChanged) - -public: - using RoleFilter::RoleFilter; - - QVariant minimumValue() const; - void setMinimumValue(QVariant minimumValue); - bool minimumInclusive() const; - void setMinimumInclusive(bool minimumInclusive); - - QVariant maximumValue() const; - void setMaximumValue(QVariant maximumValue); - bool maximumInclusive() const; - void setMaximumInclusive(bool maximumInclusive); - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; - -Q_SIGNALS: - void minimumValueChanged(); - void minimumInclusiveChanged(); - void maximumValueChanged(); - void maximumInclusiveChanged(); - -private: - QVariant m_minimumValue; - bool m_minimumInclusive = true; - QVariant m_maximumValue; - bool m_maximumInclusive = true; -}; - -} - -#endif // RANGEFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/regexpfilter.cpp b/client/3rd/SortFilterProxyModel/filters/regexpfilter.cpp deleted file mode 100644 index 7c6b6f02..00000000 --- a/client/3rd/SortFilterProxyModel/filters/regexpfilter.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "regexpfilter.h" -#include - -namespace qqsfpm { - -/*! - \qmltype RegExpFilter - \inherits RoleFilter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Filters rows matching a regular expression. - - A RegExpFilter is a \l RoleFilter that accepts rows matching a regular rexpression. - - In the following example, only rows with their \c lastName role beggining with the content of textfield the will be accepted: - \code - TextField { - id: nameTextField - } - - SortFilterProxyModel { - sourceModel: contactModel - filters: RegExpFilter { - roleName: "lastName" - pattern: "^" + nameTextField.displayText - } - } - \endcode -*/ - -/*! - \qmlproperty bool RegExpFilter::pattern - - The pattern used to filter the contents of the source model. - - \sa syntax -*/ -RegExpFilter::RegExpFilter() : - m_caseSensitivity(m_regExp.patternOptions().testFlag( - QRegularExpression::CaseInsensitiveOption) ? Qt::CaseInsensitive : Qt::CaseSensitive) -{ -} - -QString RegExpFilter::pattern() const -{ - return m_pattern; -} - -void RegExpFilter::setPattern(const QString& pattern) -{ - if (m_pattern == pattern) - return; - - m_pattern = pattern; - m_regExp.setPattern(pattern); - Q_EMIT patternChanged(); - invalidate(); -} - -/*! - \qmlproperty Qt::CaseSensitivity RegExpFilter::caseSensitivity - - This property holds the caseSensitivity of the filter. -*/ -Qt::CaseSensitivity RegExpFilter::caseSensitivity() const -{ - return m_caseSensitivity; -} - -void RegExpFilter::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity) -{ - if (m_caseSensitivity == caseSensitivity) - return; - - m_caseSensitivity = caseSensitivity; - QRegularExpression::PatternOptions patternOptions = m_regExp.patternOptions(); - if (caseSensitivity == Qt::CaseInsensitive) - patternOptions.setFlag(QRegularExpression::CaseInsensitiveOption); - m_regExp.setPatternOptions(patternOptions); - Q_EMIT caseSensitivityChanged(); - invalidate(); -} - -bool RegExpFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - const QString string = sourceData(sourceIndex, proxyModel).toString(); - return m_regExp.match(string).hasMatch(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/regexpfilter.h b/client/3rd/SortFilterProxyModel/filters/regexpfilter.h deleted file mode 100644 index 65945649..00000000 --- a/client/3rd/SortFilterProxyModel/filters/regexpfilter.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef REGEXPFILTER_H -#define REGEXPFILTER_H - -#include "rolefilter.h" - -#include - -namespace qqsfpm { - -class RegExpFilter : public RoleFilter { - Q_OBJECT - Q_PROPERTY(QString pattern READ pattern WRITE setPattern NOTIFY patternChanged) - Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity NOTIFY caseSensitivityChanged) - -public: - using RoleFilter::RoleFilter; - - RegExpFilter(); - - QString pattern() const; - void setPattern(const QString& pattern); - - Qt::CaseSensitivity caseSensitivity() const; - void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); - -protected: - bool filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; - -Q_SIGNALS: - void patternChanged(); - void caseSensitivityChanged(); - -private: - QRegularExpression m_regExp; - Qt::CaseSensitivity m_caseSensitivity; - QString m_pattern = m_regExp.pattern(); -}; - -} - -#endif // REGEXPFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/rolefilter.cpp b/client/3rd/SortFilterProxyModel/filters/rolefilter.cpp deleted file mode 100644 index 3532c878..00000000 --- a/client/3rd/SortFilterProxyModel/filters/rolefilter.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "rolefilter.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype RoleFilter - \qmlabstract - \inherits Filter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Base type for filters based on a source model role. - - The RoleFilter type cannot be used directly in a QML file. - It exists to provide a set of common properties and methods, - available across all the other filter types that inherit from it. - Attempting to use the RoleFilter type directly will result in an error. -*/ - -/*! - \qmlproperty string RoleFilter::roleName - - This property holds the role name that the filter is using to query the source model's data when filtering items. -*/ -const QString& RoleFilter::roleName() const -{ - return m_roleName; -} - -void RoleFilter::setRoleName(const QString& roleName) -{ - if (m_roleName == roleName) - return; - - m_roleName = roleName; - Q_EMIT roleNameChanged(); - invalidate(); -} - -QVariant RoleFilter::sourceData(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - return proxyModel.sourceData(sourceIndex, m_roleName); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/rolefilter.h b/client/3rd/SortFilterProxyModel/filters/rolefilter.h deleted file mode 100644 index 920ed6cc..00000000 --- a/client/3rd/SortFilterProxyModel/filters/rolefilter.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ROLEFILTER_H -#define ROLEFILTER_H - -#include "filter.h" - -namespace qqsfpm { - -class RoleFilter : public Filter -{ - Q_OBJECT - Q_PROPERTY(QString roleName READ roleName WRITE setRoleName NOTIFY roleNameChanged) - -public: - using Filter::Filter; - - const QString& roleName() const; - void setRoleName(const QString& roleName); - -Q_SIGNALS: - void roleNameChanged(); - -protected: - QVariant sourceData(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const; - -private: - QString m_roleName; -}; - -} - -#endif // ROLEFILTER_H diff --git a/client/3rd/SortFilterProxyModel/filters/valuefilter.cpp b/client/3rd/SortFilterProxyModel/filters/valuefilter.cpp deleted file mode 100644 index 09e9434a..00000000 --- a/client/3rd/SortFilterProxyModel/filters/valuefilter.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "valuefilter.h" - -namespace qqsfpm { - -/*! - \qmltype ValueFilter - \inherits RoleFilter - \inqmlmodule SortFilterProxyModel - \ingroup Filters - \brief Filters rows matching exactly a value. - - A ValueFilter is a simple \l RoleFilter that accepts rows matching exactly the filter's value - - In the following example, only rows with their \c favorite role set to \c true will be accepted when the checkbox is checked : - \code - CheckBox { - id: showOnlyFavoriteCheckBox - } - - SortFilterProxyModel { - sourceModel: contactModel - filters: ValueFilter { - roleName: "favorite" - value: true - enabled: showOnlyFavoriteCheckBox.checked - } - } - \endcode - -*/ - -/*! - \qmlproperty variant ValueFilter::value - - This property holds the value used to filter the contents of the source model. -*/ -const QVariant &ValueFilter::value() const -{ - return m_value; -} - -void ValueFilter::setValue(const QVariant& value) -{ - if (m_value == value) - return; - - m_value = value; - Q_EMIT valueChanged(); - invalidate(); -} - -bool ValueFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - return !m_value.isValid() || m_value == sourceData(sourceIndex, proxyModel); -} - -} diff --git a/client/3rd/SortFilterProxyModel/filters/valuefilter.h b/client/3rd/SortFilterProxyModel/filters/valuefilter.h deleted file mode 100644 index 2436094c..00000000 --- a/client/3rd/SortFilterProxyModel/filters/valuefilter.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VALUEFILTER_H -#define VALUEFILTER_H - -#include "rolefilter.h" -#include - -namespace qqsfpm { - -class ValueFilter : public RoleFilter { - Q_OBJECT - Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) - -public: - using RoleFilter::RoleFilter; - - const QVariant& value() const; - void setValue(const QVariant& value); - -protected: - bool filterRow(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const override; - -Q_SIGNALS: - void valueChanged(); - -private: - QVariant m_value; -}; - -} - -#endif // VALUEFILTER_H diff --git a/client/3rd/SortFilterProxyModel/index.qdoc b/client/3rd/SortFilterProxyModel/index.qdoc deleted file mode 100644 index e4917bb2..00000000 --- a/client/3rd/SortFilterProxyModel/index.qdoc +++ /dev/null @@ -1,27 +0,0 @@ -/*! - \page index.html overview - - \title SortFilterProxyModel QML Module - - SortFilterProxyModel is an implementation of QSortFilterProxyModel conveniently exposed for QML. - \annotatedlist SortFilterProxyModel - - \section1 Filters - \annotatedlist Filters - - \section2 Related attached types - \annotatedlist FilterAttached - - \section1 Sorters - \annotatedlist Sorters - - \section2 Related attached types - \annotatedlist SorterAttached - - \section1 ProxyRoles - \annotatedlist ProxyRoles -*/ - -/*! - \qmlmodule SortFilterProxyModel -*/ diff --git a/client/3rd/SortFilterProxyModel/offline.css b/client/3rd/SortFilterProxyModel/offline.css deleted file mode 100644 index 13c94270..00000000 --- a/client/3rd/SortFilterProxyModel/offline.css +++ /dev/null @@ -1,805 +0,0 @@ -body { - font: normal 400 14px/1.2 Arial; - margin-top: 85px; - font-family: Arial, Helvetica; - text-align: left; - margin-left: 5px; - margin-right: 5px; - background-color: #fff; -} - -p { - line-height: 20px -} - -img { - margin-left: 0px; - max-width: 800px; - height: auto; -} - -.content .border img { - box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5) -} - -.content .border .player { - box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5) -} - -.content .indexboxcont li { - font: normal bold 13px/1 Verdana - } - -.content .normallist li { - font: normal 13px/1 Verdana - } - -.descr { - margin-top: 35px; - margin-bottom: 45px; - margin-left: 5px; - text-align: left; - vertical-align: top; -} - -.name { - max-width: 75%; - font-weight: 100; -} - -tt { - text-align: left -} - -/* ------------ -links ------------ -*/ - -a:link { - color: #007330; - text-decoration: none; - text-align: left; -} - -a.qa-mark:target:before { - content: "***"; - color: #ff0000; -} - -a:hover { - color: #44a51c; - text-align: left; -} - -a:visited { - color: #007330; - text-align: left; -} - -a:visited:hover { - color: #44a51c; - text-align: left; -} - -/* ------------ -offline viewing: HTML links display an icon ------------ -*/ - -a[href*="http://"], a[href*="ftp://"], a[href*="https://"] { - text-decoration: none; - background-image: url(../images/ico_out.png); - background-repeat: no-repeat; - background-position: left; - padding-left: 20px; - text-align: left; -} - -.flags { - text-decoration: none; - text-height: 24px; -} - -.flags:target { - background-color: #FFFFD6; -} - -/* -------------------------------- -NOTE styles -------------------------------- -*/ - -.notetitle, .tiptitle, .fastpathtitle { - font-weight: bold -} - -.attentiontitle, .cautiontitle, .dangertitle, .importanttitle, .remembertitle, .restrictiontitle { - font-weight: bold -} - -.note, .tip, .fastpath { - background: #F2F2F2 url(../images/ico_note.png); - background-repeat: no-repeat; - background-position: top left; - padding: 5px; - padding-left: 40px; - padding-bottom: 10px; - border: #999 1px dotted; - color: #666666; - margin: 5px; -} - -.attention, .caution, .danger, .important, .remember, .restriction { - background: #F2F2F2 url(../images/ico_note_attention.png); - background-repeat: no-repeat; - background-position: top left; - padding: 5px; - padding-left: 40px; - padding-bottom: 10px; - border: #999 1px dotted; - color: #666666; - margin: 5px; -} - -/* -------------------------------- -Top navigation -------------------------------- -*/ - -.qtref { - display: block; - position: relative; - height: 15px; - z-index: 1; - font-size: 11px; - padding-right: 10px; - float: right; -} - -.naviNextPrevious { - clear: both; - display: block; - position: relative; - text-align: right; - top: -47px; - float: right; - height: 20px; - z-index: 1; - padding-right: 10px; - padding-top: 2px; - vertical-align: top; - margin: 0px; -} - -.naviNextPrevious > a:first-child { - background-image: url(../images/btn_prev.png); - background-repeat: no-repeat; - background-position: left; - padding-left: 20px; - height: 20px; - padding-left: 20px; - } - -.naviNextPrevious > a:last-child { - background-image: url(../images/btn_next.png); - background-repeat: no-repeat; - background-position: right; - padding-right: 20px; - height: 20px; - margin-left: 30px; - } - -.naviSeparator { display: none } -/* ------------ -footer and license ------------ -*/ - -.footer { - text-align: left; - padding-top: 45px; - padding-left: 5px; - margin-top: 45px; - margin-bottom: 45px; - font-size: 10px; - border-top: 1px solid #999; -} - -.footer p { - line-height: 14px; - font-size: 11px; - padding: 0; - margin: 0; -} - -.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] { - font-weight: bold; -} - -.footerNavi { - width: auto; - text-align: right; - margin-top: 50px; - z-index: 1; -} - -.navigationbar { - display: block; - position: relative; - top: -20px; - border-top: 1px solid #cecece; - border-bottom: 1px solid #cecece; - background-color: #F2F2F2; - z-index: 1; - height: 20px; - padding-left: 7px; - margin: 0px; - padding-top: 2px; - margin-left: -5px; - margin-right: -5px; -} - -.navigationbar .first { - background: url(../images/home.png); - background-position: left; - background-repeat: no-repeat; - padding-left: 20px; - } - -.navigationbar ul { - margin: 0px; - padding: 0px; - } - - .navigationbar ul li { - list-style-type: none; - padding-top: 2px; - padding-left: 4px; - margin: 0; - height: 20px; - } - -.navigationbar li { - float: left - } - - .navigationbar li a, .navigationbar td a { - display: block; - text-decoration: none; - background: url(../images/arrow_bc.png); - background-repeat: no-repeat; - background-position: right; - padding-right: 17px; - } - -table.buildversion { - float: right; - margin-top: -18px !important; -} - -.navigationbar table { - border-radius: 0; - border: 0 none; - background-color: #F2F2F2; - margin: 0; -} - -.navigationbar table td { - padding: 0; - border: 0 none; -} - -#buildversion { - font-style: italic; - font-size: small; - float: right; - margin-right: 5px; -} - -/* - -/* table of content -no display -*/ - -/* ------------ -headers ------------ -*/ - -@media screen { - .title { - color: #313131; - font-size: 24px; - font-weight: normal; - left: 0; - padding-bottom: 20px; - padding-left: 10px; - padding-top: 20px; - position: absolute; - right: 0; - top: 0; - background-color: #E6E6E6; - border-bottom: 1px #CCC solid; - border-top: 2px #CCC solid; - font-weight: bold; - margin-left: 0px; - margin-right: 0px; - } - .subtitle, .small-subtitle { - display: block; - clear: left; - } -} - -h1 { - margin: 0 -} - -h2, p.h2 { - font: 500 16px/1.2 Arial; - font-weight: 100; - background-color: #F2F3F4; - padding: 4px; - margin-bottom: 30px; - margin-top: 30px; - border-top: #E0E0DE 1px solid; - border-bottom: #E0E0DE 1px solid; - max-width: 99%; -} - -h2:target { - background-color: #F2F3D4; -} - -h3 { - font: 500 14px/1.2 Arial; - font-weight: 100; - text-decoration: underline; - margin-bottom: 30px; - margin-top: 30px; -} - -h3.fn, span.fn { - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - word-spacing: 3px; - padding: 5px 5px; - text-decoration: none; - font-weight: bold; - max-width: 75%; - font-size: 14px; - margin: 0px; - margin-top: 45px; -} -.fngroup h3.fngroupitem { - margin-bottom: 5px; -} -h3.fn code { - float: right; -} -h3.fn:target { - background-color: #F6F6D6; -} - -.name { - color: #1A1A1A -} - -.type { - color: #808080 -} - -@media print { - .title { - color: #0066CB; - font-family: Arial, Helvetica; - font-size: 32px; - font-weight: normal; - left: 0; - position: absolute; - right: 0; - top: 0; - } -} - -/* ------------------ -table styles ------------------ -*/ - -.table img { - border: none; - margin-left: 0px; - -moz-box-shadow: 0px 0px 0px #fff; - -webkit-box-shadow: 0px 0px 0px #fff; - box-shadow: 0px 0px 0px #fff; -} - -/* table with border alternative colours*/ - -table, pre, .LegaleseLeft { - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - margin-bottom: 25px; - margin-left: 15px; - font-size: 12px; - line-height: 1.2; -} - - table tr.even { - background-color: white; - color: #66666E; - } - - table tr.odd { - background-color: #F6F6F6; - color: #66666E; - } - - table tr:target { - background-color: #F6F6D6; - } - - table thead { - text-align: left; - padding-left: 20px; - background-color: #e1e0e0; - border-left: none; - border-right: none; - } - - table thead th { - padding-top: 5px; - padding-left: 10px; - padding-bottom: 5px; - border-bottom: 2px solid #D1D1D1; - padding-right: 10px; - } - - table th { - text-align: left; - padding-left: 20px; - } - - table td { - padding: 3px 15px 3px 20px; - border-bottom: #CCC dotted 1px; - } - - table p { - margin: 0px - } - -.LegaleseLeft { - font-family: monospace; - white-space: pre-wrap; -} -/* table bodless & white*/ - -.borderless { - border-radius: 0px 0px 0px 0px; - background-color: #fff; - border: 1px solid #fff; -} - -.borderless tr { - background-color: #FFF; - color: #66666E; - } - -.borderless td { - border: none; - border-bottom: #fff dotted 1px; - } - -/* ------------ -List ------------ -*/ - -ul { - margin-top: 10px; -} - -li { - margin-bottom: 10px; - padding-left: 8px; - list-style: outside; - text-align: left; -} - - ul > li { - list-style-type: square; - } - -ol { - margin: 10px; - padding: 0; -} - -ol.A > li { - list-style-type: upper-alpha; -} - -ol.a > li{ - list-style-type: lower-alpha; -} - - ol > li { - margin-left: 30px; - padding-left: 8px; - list-style: decimal; - } - -.centerAlign { - text-align: left -} - -.cpp, .LegaleseLeft { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.js { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.memItemLeft { - padding-right: 3px -} - -.memItemRight { - padding: 3px 15px 3px 0 -} - -.qml { - display: block; - margin: 10px; - overflow: auto; - padding: 20px 20px 20px 20px; -} - -.qmldefault { - padding-left: 5px; - float: right; - color: red; -} - -.qmlreadonly { - padding-left: 5px; - float: right; - color: #254117; -} - -.rightAlign { - padding: 3px 5px 3px 10px; - text-align: right; -} - -.qmldoc { - margin-left: 15px -} - -.flowList { - padding: 25px -} -.flowList dd { - display: inline-block; - margin-left: 10px; - width: 255px; - line-height: 1.15em; - overflow-x: hidden; - text-overflow: ellipsis -} -.alphaChar { - font-size: 2em; - position: relative -} -/* ------------ -Content table ------------ -*/ - -@media print { - .toc { - float: right; - clear: right; - padding-bottom: 10px; - padding-top: 50px; - width: 100%; - background-image: url(../images/bgrContent.png); - background-position: top; - background-repeat: no-repeat; - } -} - -@media screen { - .toc { - float: right; - clear: right; - vertical-align: top; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - background: #FFF url('../images/bgrContent.png'); - background-position: top; - background-repeat: repeat-x; - border: 1px solid #E6E6E6; - padding-left: 5px; - padding-bottom: 10px; - height: auto; - width: 200px; - text-align: left; - margin-left: 20px; - } -} - - -.toc h3 { - text-decoration: none -} - -.toc h3 { - font: 500 14px/1.2 Arial; - font-weight: 100; - padding: 0px; - margin: 0px; - padding-top: 5px; - padding-left: 5px; -} - -.toc ul { - padding-left: 10px; - padding-right: 5px; -} - -.toc ul li { - margin-left: 15px; - list-style-image: url(../images/bullet_dn.png); - marker-offset: 0px; - margin-bottom: 8px; - padding-left: 0px; - } - -.toc .level1 { - border: none -} - -.toc .level2 { - border: none; - margin-left: 25px; -} - -.level3 { - border: none; - margin-left: 30px; -} - -.clearfix { - clear: both -} - -/* ------------ -Landing page ------------ -*/ - -.col-group { - white-space: nowrap; - vertical-align: top; -} - - -.landing h2 { - background-color: transparent; - border: none; - margin-bottom: 0px; - font-size: 18px; -} - -.landing a, .landing li { - font-size: 13px; - font-weight: bold !important; -} - -.col-1 { - display: inline-block; - white-space: normal; - width: 70%; - height: 100%; - float: left; -} - -.col-2 { - display: inline-block; - white-space: normal; - width: 20%; - margin-left: 5%; - position: relative; - top: -20px; -} - -.col-1 h1 { - margin: 20px 0 0 0; - } - -.col-1 h2 { - font-size: 18px; - font-weight: bold !important; -} - -.landingicons { - display: inline-block; - width: 100%; -} - -.icons1of3 { - display: inline-block; - width: 33.3333%; - float: left; -} - -.icons1of3 h2, .doc-column h2 { - font-size: 15px; - margin: 0px; - padding: 0px; -} - -div.multi-column { - position: relative; -} - -div.multi-column div { - display: -moz-inline-box; - display: inline-block; - vertical-align: top; - margin-top: 1em; - margin-right: 4em; - width: 24em; -} - -.mainContent .video { - width:40%; - max-width:640px; - margin: 15px 0 0 15px; - position:relative; - display:table -} - -.mainContent .video > .vspan { - padding-top:60%; - display:block -} -.mainContent .video iframe { - width:100%; - height:100%; - position:absolute; - top:0; - left:0 -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.cpp deleted file mode 100644 index 70af4fa2..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "expressionrole.h" -#include "qqmlsortfilterproxymodel.h" -#include - -namespace qqsfpm { - -/*! - \qmltype ExpressionRole - \inherits SingleRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \brief A custom role computed from a javascript expression. - - An ExpressionRole is a \l ProxyRole allowing to implement a custom role based on a javascript expression. - - In the following example, the \c c role is computed by adding the \c a role and \c b role of the model : - \code - SortFilterProxyModel { - sourceModel: numberModel - proxyRoles: ExpressionRole { - name: "c" - expression: model.a + model.b - } - } - \endcode -*/ - -/*! - \qmlproperty expression ExpressionRole::expression - - An expression to implement a custom role. - It has the same syntax has a \l {http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html} {Property Binding} except it will be evaluated for each of the source model's rows. - The data for this role will be the retuned valued of the expression. - Data for each row is exposed like for a delegate of a QML View. - - This expression is reevaluated for a row every time its model data changes. - When an external property (not \c index or in \c model) the expression depends on changes, the expression is reevaluated for every row of the source model. - To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. - This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes. - - A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression. -*/ -const QQmlScriptString& ExpressionRole::expression() const -{ - return m_scriptString; -} - -void ExpressionRole::setExpression(const QQmlScriptString& scriptString) -{ - if (m_scriptString == scriptString) - return; - - m_scriptString = scriptString; - updateExpression(); - - Q_EMIT expressionChanged(); - invalidate(); -} - -void ExpressionRole::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - updateContext(proxyModel); -} - -QVariant ExpressionRole::data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) -{ - if (!m_scriptString.isEmpty()) { - QVariantMap modelMap; - QHash roles = proxyModel.roleNames(); - - QQmlContext context(qmlContext(this)); - auto addToContext = [&] (const QString &name, const QVariant& value) { - context.setContextProperty(name, value); - modelMap.insert(name, value); - }; - - for (auto it = roles.cbegin(); it != roles.cend(); ++it) - addToContext(it.value(), proxyModel.sourceData(sourceIndex, it.key())); - addToContext("index", sourceIndex.row()); - - context.setContextProperty("model", modelMap); - - QQmlExpression expression(m_scriptString, &context); - QVariant result = expression.evaluate(); - - if (expression.hasError()) { - qWarning() << expression.error(); - return true; - } - return result; - } - return QVariant(); -} - -void ExpressionRole::updateContext(const QQmlSortFilterProxyModel& proxyModel) -{ - delete m_context; - m_context = new QQmlContext(qmlContext(this), this); - // what about roles changes ? - QVariantMap modelMap; - - auto addToContext = [&] (const QString &name, const QVariant& value) { - m_context->setContextProperty(name, value); - modelMap.insert(name, value); - }; - - for (const QByteArray& roleName : proxyModel.roleNames().values()) - addToContext(roleName, QVariant()); - - addToContext("index", -1); - - m_context->setContextProperty("model", modelMap); - updateExpression(); -} - -void ExpressionRole::updateExpression() -{ - if (!m_context) - return; - - delete m_expression; - m_expression = new QQmlExpression(m_scriptString, m_context, 0, this); - connect(m_expression, &QQmlExpression::valueChanged, this, &ExpressionRole::invalidate); - m_expression->setNotifyOnValueChanged(true); - m_expression->evaluate(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.h b/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.h deleted file mode 100644 index eda3d51f..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/expressionrole.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef EXPRESSIONROLE_H -#define EXPRESSIONROLE_H - -#include "singlerole.h" -#include - -class QQmlExpression; - -namespace qqsfpm { - -class ExpressionRole : public SingleRole -{ - Q_OBJECT - Q_PROPERTY(QQmlScriptString expression READ expression WRITE setExpression NOTIFY expressionChanged) - -public: - using SingleRole::SingleRole; - - const QQmlScriptString& expression() const; - void setExpression(const QQmlScriptString& scriptString); - - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - -Q_SIGNALS: - void expressionChanged(); - -private: - QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) override; - void updateContext(const QQmlSortFilterProxyModel& proxyModel); - void updateExpression(); - - QQmlScriptString m_scriptString; - QQmlExpression* m_expression = nullptr; - QQmlContext* m_context = nullptr; -}; - -} - -#endif // EXPRESSIONROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/filterrole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/filterrole.cpp deleted file mode 100644 index 84dcbcd3..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/filterrole.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "filterrole.h" -#include "filters/filter.h" - -namespace qqsfpm { - -/*! - \qmltype FilterRole - \inherits SingleRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \ingroup FilterContainer - \brief A role resolving to \c true for rows matching all its filters. - - A FilterRole is a \l ProxyRole that returns \c true for rows matching all its filters. - - In the following example, the \c isAdult role will be equal to \c true if the \c age role is superior or equal to 18. - \code - SortFilterProxyModel { - sourceModel: personModel - proxyRoles: FilterRole { - name: "isAdult" - RangeFilter { roleName: "age"; minimumValue: 18; minimumInclusive: true } - } - } - \endcode - \sa FilterContainer -*/ - -/*! - \qmlproperty list FilterRole::filters - \default - - This property holds the list of filters for this filter role. - The data of this role will be equal to the \c true if all its filters match the model row, \c false otherwise. - - \sa Filter, FilterContainer -*/ - -void FilterRole::onFilterAppended(Filter* filter) -{ - connect(filter, &Filter::invalidated, this, &FilterRole::invalidate); - invalidate(); -} - -void FilterRole::onFilterRemoved(Filter* filter) -{ - disconnect(filter, &Filter::invalidated, this, &FilterRole::invalidate); - invalidate(); -} - -void FilterRole::onFiltersCleared() -{ - invalidate(); -} - -QVariant FilterRole::data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) -{ - return std::all_of(m_filters.begin(), m_filters.end(), - [&] (Filter* filter) { - return filter->filterAcceptsRow(sourceIndex, proxyModel); - } - ); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/filterrole.h b/client/3rd/SortFilterProxyModel/proxyroles/filterrole.h deleted file mode 100644 index dd1285a3..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/filterrole.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef FILTERROLE_H -#define FILTERROLE_H - -#include "singlerole.h" -#include "filters/filtercontainer.h" - -namespace qqsfpm { - -class FilterRole : public SingleRole, public FilterContainer -{ - Q_OBJECT - Q_INTERFACES(qqsfpm::FilterContainer) - Q_PROPERTY(QQmlListProperty filters READ filtersListProperty) - Q_CLASSINFO("DefaultProperty", "filters") - -public: - using SingleRole::SingleRole; - -private: - void onFilterAppended(Filter* filter) override; - void onFilterRemoved(Filter* filter) override; - void onFiltersCleared() override; - - QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) override; -}; - -} - -#endif // FILTERROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/joinrole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/joinrole.cpp deleted file mode 100644 index c252be31..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/joinrole.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "joinrole.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype JoinRole - \inherits SingleRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \brief a role made from concatenating other roles. - - A JoinRole is a simple \l ProxyRole that concatenates other roles. - - In the following example, the \c fullName role is computed by the concatenation of the \c firstName role and the \c lastName role separated by a space : - \code - SortFilterProxyModel { - sourceModel: contactModel - proxyRoles: JoinRole { - name: "fullName" - roleNames: ["firstName", "lastName"] - } - } - \endcode - -*/ - -/*! - \qmlproperty list JoinRole::roleNames - - This property holds the role names that are joined by this role. -*/ -QStringList JoinRole::roleNames() const -{ - return m_roleNames; -} - -void JoinRole::setRoleNames(const QStringList& roleNames) -{ - if (m_roleNames == roleNames) - return; - - m_roleNames = roleNames; - Q_EMIT roleNamesChanged(); - invalidate(); -} - -/*! - \qmlproperty string JoinRole::separator - - This property holds the separator that is used to join the roles specified in \l roleNames. - - By default, it's a space. -*/ -QString JoinRole::separator() const -{ - return m_separator; -} - -void JoinRole::setSeparator(const QString& separator) -{ - if (m_separator == separator) - return; - - m_separator = separator; - Q_EMIT separatorChanged(); - invalidate(); -} - -QVariant JoinRole::data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel& proxyModel) -{ - QString result; - - for (const QString& roleName : m_roleNames) - result += proxyModel.sourceData(sourceIndex, roleName).toString() + m_separator; - - if (!m_roleNames.isEmpty()) - result.chop(m_separator.length()); - - return result; -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/joinrole.h b/client/3rd/SortFilterProxyModel/proxyroles/joinrole.h deleted file mode 100644 index 520b861b..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/joinrole.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef JOINROLE_H -#define JOINROLE_H - -#include "singlerole.h" - -namespace qqsfpm { - -class JoinRole : public SingleRole -{ - Q_OBJECT - Q_PROPERTY(QStringList roleNames READ roleNames WRITE setRoleNames NOTIFY roleNamesChanged) - Q_PROPERTY(QString separator READ separator WRITE setSeparator NOTIFY separatorChanged) - -public: - using SingleRole::SingleRole; - - QStringList roleNames() const; - void setRoleNames(const QStringList& roleNames); - - QString separator() const; - void setSeparator(const QString& separator); - -Q_SIGNALS: - void roleNamesChanged(); - - void separatorChanged(); - -private: - QStringList m_roleNames; - QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) override; - QString m_separator = " "; -}; - -} - -#endif // JOINROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.cpp deleted file mode 100644 index 172b0c2e..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "proxyrole.h" -#include -#include -#include -#include -#include -#include -#include "filters/filter.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype ProxyRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \brief Base type for the \l SortFilterProxyModel proxy roles. - - The ProxyRole type cannot be used directly in a QML file. - It exists to provide a set of common properties and methods, - available across all the other proxy role types that inherit from it. - Attempting to use the ProxyRole type directly will result in an error. -*/ - -QVariant ProxyRole::roleData(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString &name) -{ - if (m_mutex.tryLock()) { - QVariant result = data(sourceIndex, proxyModel, name); - m_mutex.unlock(); - return result; - } else { - return {}; - } -} - -void ProxyRole::proxyModelCompleted(const QQmlSortFilterProxyModel &proxyModel) -{ - Q_UNUSED(proxyModel) -} - -void ProxyRole::invalidate() -{ - Q_EMIT invalidated(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.h b/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.h deleted file mode 100644 index 5c1ff93c..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/proxyrole.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef PROXYROLE_H -#define PROXYROLE_H - -#include -#include - -namespace qqsfpm { - -class QQmlSortFilterProxyModel; - -class ProxyRole : public QObject -{ - Q_OBJECT - -public: - using QObject::QObject; - virtual ~ProxyRole() = default; - - QVariant roleData(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString& name); - virtual void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel); - - virtual QStringList names() = 0; - -protected: - void invalidate(); - -Q_SIGNALS: - void invalidated(); - void namesAboutToBeChanged(); - void namesChanged(); - -private: - virtual QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString& name) = 0; - - QMutex m_mutex; -}; - -} - -#endif // PROXYROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.cpp b/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.cpp deleted file mode 100644 index 8418fec7..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "proxyrolecontainer.h" - -namespace qqsfpm { - -QList ProxyRoleContainer::proxyRoles() const -{ - return m_proxyRoles; -} - -void ProxyRoleContainer::appendProxyRole(ProxyRole* proxyRole) -{ - m_proxyRoles.append(proxyRole); - onProxyRoleAppended(proxyRole); -} - -void ProxyRoleContainer::removeProxyRole(ProxyRole* proxyRole) -{ - m_proxyRoles.removeOne(proxyRole); - onProxyRoleRemoved(proxyRole); -} - -void ProxyRoleContainer::clearProxyRoles() -{ - m_proxyRoles.clear(); - onProxyRolesCleared(); -} - -QQmlListProperty ProxyRoleContainer::proxyRolesListProperty() -{ - return QQmlListProperty(reinterpret_cast(this), &m_proxyRoles, - &ProxyRoleContainer::append_proxyRole, - &ProxyRoleContainer::count_proxyRole, - &ProxyRoleContainer::at_proxyRole, - &ProxyRoleContainer::clear_proxyRoles); -} - -void ProxyRoleContainer::append_proxyRole(QQmlListProperty* list, ProxyRole* proxyRole) -{ - if (!proxyRole) - return; - - ProxyRoleContainer* that = reinterpret_cast(list->object); - that->appendProxyRole(proxyRole); -} - -qsizetype ProxyRoleContainer::count_proxyRole(QQmlListProperty* list) -{ - QList* ProxyRoles = static_cast*>(list->data); - return ProxyRoles->count(); -} - -ProxyRole* ProxyRoleContainer::at_proxyRole(QQmlListProperty* list, qsizetype index) -{ - QList* ProxyRoles = static_cast*>(list->data); - return ProxyRoles->at(index); -} - -void ProxyRoleContainer::clear_proxyRoles(QQmlListProperty *list) -{ - ProxyRoleContainer* that = reinterpret_cast(list->object); - that->clearProxyRoles(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.h b/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.h deleted file mode 100644 index 415b8c0b..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolecontainer.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef PROXYROLECONTAINER_H -#define PROXYROLECONTAINER_H - -#include -#include - -namespace qqsfpm { - -class ProxyRole; -class QQmlSortFilterProxyModel; - -class ProxyRoleContainer { -public: - virtual ~ProxyRoleContainer() = default; - - QList proxyRoles() const; - void appendProxyRole(ProxyRole* proxyRole); - void removeProxyRole(ProxyRole* proxyRole); - void clearProxyRoles(); - - QQmlListProperty proxyRolesListProperty(); - -protected: - QList m_proxyRoles; - -private: - virtual void onProxyRoleAppended(ProxyRole* proxyRole) = 0; - virtual void onProxyRoleRemoved(ProxyRole* proxyRole) = 0; - virtual void onProxyRolesCleared() = 0; - - static void append_proxyRole(QQmlListProperty* list, ProxyRole* proxyRole); - static qsizetype count_proxyRole(QQmlListProperty* list); - static ProxyRole* at_proxyRole(QQmlListProperty* list, qsizetype index); - static void clear_proxyRoles(QQmlListProperty* list); -}; - -} - -#define ProxyRoleContainer_iid "fr.grecko.SortFilterProxyModel.ProxyRoleContainer" -Q_DECLARE_INTERFACE(qqsfpm::ProxyRoleContainer, ProxyRoleContainer_iid) - -#endif // PROXYROLECONTAINER_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolesqmltypes.cpp b/client/3rd/SortFilterProxyModel/proxyroles/proxyrolesqmltypes.cpp deleted file mode 100644 index efea2563..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/proxyrolesqmltypes.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "proxyrole.h" -#include "joinrole.h" -#include "switchrole.h" -#include "expressionrole.h" -#include "regexprole.h" -#include "filterrole.h" -#include -#include - -namespace qqsfpm { - -void registerProxyRoleTypes() { - qmlRegisterUncreatableType("SortFilterProxyModel", 0, 2, "ProxyRole", "ProxyRole is an abstract class"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "JoinRole"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "SwitchRole"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "ExpressionRole"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "RegExpRole"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "FilterRole"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerProxyRoleTypes) - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/regexprole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/regexprole.cpp deleted file mode 100644 index fc9784d6..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/regexprole.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "regexprole.h" -#include "qqmlsortfilterproxymodel.h" -#include - -namespace qqsfpm { - -/*! - \qmltype RegExpRole - \inherits ProxyRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \brief A ProxyRole extracting data from a source role via a regular expression. - - A RegExpRole is a \l ProxyRole that provides a role for each named capture group of its regular expression \l pattern. - - In the following example, the \c date role of the source model will be extracted in 3 roles in the proxy moodel: \c year, \c month and \c day. - \code - SortFilterProxyModel { - sourceModel: eventModel - proxyRoles: RegExpRole { - roleName: "date" - pattern: "(?\\d{4})-(?\\d{2})-(?\\d{2})" - } - } - \endcode -*/ - -/*! - \qmlproperty QString RegExpRole::roleName - - This property holds the role name that the RegExpRole is using to query the source model's data to extract new roles from. -*/ -QString RegExpRole::roleName() const -{ - return m_roleName; -} - -void RegExpRole::setRoleName(const QString& roleName) -{ - if (m_roleName == roleName) - return; - - m_roleName = roleName; - Q_EMIT roleNameChanged(); -} - -/*! - \qmlproperty QString RegExpRole::pattern - - This property holds the pattern of the regular expression of this RegExpRole. - The RegExpRole will expose a role for each of the named capture group of the pattern. -*/ -QString RegExpRole::pattern() const -{ - return m_regularExpression.pattern(); -} - -void RegExpRole::setPattern(const QString& pattern) -{ - if (m_regularExpression.pattern() == pattern) - return; - - Q_EMIT namesAboutToBeChanged(); - m_regularExpression.setPattern(pattern); - invalidate(); - Q_EMIT patternChanged(); - Q_EMIT namesChanged(); -} - -/*! - \qmlproperty Qt::CaseSensitivity RegExpRole::caseSensitivity - - This property holds the caseSensitivity of the regular expression. -*/ -Qt::CaseSensitivity RegExpRole::caseSensitivity() const -{ - return m_regularExpression.patternOptions() & QRegularExpression::CaseInsensitiveOption ? - Qt::CaseInsensitive : Qt::CaseSensitive; -} - -void RegExpRole::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity) -{ - if (this->caseSensitivity() == caseSensitivity) - return; - - m_regularExpression.setPatternOptions(m_regularExpression.patternOptions() ^ QRegularExpression::CaseInsensitiveOption); //toggle the option - Q_EMIT caseSensitivityChanged(); -} - -QStringList RegExpRole::names() -{ - QStringList nameCaptureGroups = m_regularExpression.namedCaptureGroups(); - nameCaptureGroups.removeAll(""); - return nameCaptureGroups; -} - -QVariant RegExpRole::data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString &name) -{ - QString text = proxyModel.sourceData(sourceIndex, m_roleName).toString(); - QRegularExpressionMatch match = m_regularExpression.match(text); - return match.hasMatch() ? (match.captured(name)) : QVariant{}; -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/regexprole.h b/client/3rd/SortFilterProxyModel/proxyroles/regexprole.h deleted file mode 100644 index d0948b78..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/regexprole.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef REGEXPROLE_H -#define REGEXPROLE_H - -#include "proxyrole.h" -#include - -namespace qqsfpm { - -class RegExpRole : public ProxyRole -{ - Q_OBJECT - Q_PROPERTY(QString roleName READ roleName WRITE setRoleName NOTIFY roleNameChanged) - Q_PROPERTY(QString pattern READ pattern WRITE setPattern NOTIFY patternChanged) - Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity NOTIFY caseSensitivityChanged) - -public: - using ProxyRole::ProxyRole; - - QString roleName() const; - void setRoleName(const QString& roleName); - - QString pattern() const; - void setPattern(const QString& pattern); - - Qt::CaseSensitivity caseSensitivity() const; - void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); - - QStringList names() override; - -Q_SIGNALS: - void roleNameChanged(); - void patternChanged(); - void caseSensitivityChanged(); - -private: - QString m_roleName; - QRegularExpression m_regularExpression; - QVariant data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel, const QString &name) override; -}; - -} - -#endif // REGEXPROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/singlerole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/singlerole.cpp deleted file mode 100644 index fb2ddde8..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/singlerole.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "singlerole.h" -#include - -namespace qqsfpm { - -/*! - \qmltype SingleRole - \qmlabstract - \inherits ProxyRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \brief Base type for the \l SortFilterProxyModel proxy roles defining a single role. - - SingleRole is a convenience base class for proxy roles who define a single role. - It cannot be used directly in a QML file. - It exists to provide a set of common properties and methods, - available across all the other proxy role types that inherit from it. - Attempting to use the SingleRole type directly will result in an error. -*/ -/*! - \qmlproperty string SingleRole::name - - This property holds the role name of the proxy role. -*/ -QString SingleRole::name() const -{ - return m_name; -} - -void SingleRole::setName(const QString& name) -{ - if (m_name == name) - return; - - Q_EMIT namesAboutToBeChanged(); - m_name = name; - Q_EMIT nameChanged(); - Q_EMIT namesChanged(); -} - -QStringList SingleRole::names() -{ - return QStringList { m_name }; -} - -QVariant SingleRole::data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel, const QString &name) -{ - Q_UNUSED(name); - return data(sourceIndex, proxyModel); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/singlerole.h b/client/3rd/SortFilterProxyModel/proxyroles/singlerole.h deleted file mode 100644 index 32b2f2b0..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/singlerole.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef SINGLEROLE_H -#define SINGLEROLE_H - -#include "proxyrole.h" - -namespace qqsfpm { - -class SingleRole : public ProxyRole -{ - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - -public: - using ProxyRole::ProxyRole; - - QString name() const; - void setName(const QString& name); - - QStringList names() override; - -Q_SIGNALS: - void nameChanged(); - -private: - QString m_name; - -private: - QVariant data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel, const QString &name) final; - virtual QVariant data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel) = 0; -}; - -} - -#endif // SINGLEROLE_H diff --git a/client/3rd/SortFilterProxyModel/proxyroles/switchrole.cpp b/client/3rd/SortFilterProxyModel/proxyroles/switchrole.cpp deleted file mode 100644 index f21de849..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/switchrole.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include "switchrole.h" -#include "qqmlsortfilterproxymodel.h" -#include "filters/filter.h" -#include - -namespace qqsfpm { - -/*! - \qmltype SwitchRole - \inherits SingleRole - \inqmlmodule SortFilterProxyModel - \ingroup ProxyRoles - \ingroup FilterContainer - \brief A role using \l Filter to conditionnaly compute its data. - - A SwitchRole is a \l ProxyRole that computes its data with the help of \l Filter. - Each top level filters specified in the \l SwitchRole is evaluated on the rows of the model, if a \l Filter evaluates to true, the data of the \l SwitchRole for this row will be the one of the attached \l {value} {SwitchRole.value} property. - If no top level filters evaluate to true, the data will default to the one of the \l defaultRoleName (or the \l defaultValue if no \l defaultRoleName is specified). - - In the following example, the \c favoriteOrFirstNameSection role is equal to \c * if the \c favorite role of a row is true, otherwise it's the same as the \c firstName role : - \code - SortFilterProxyModel { - sourceModel: contactModel - proxyRoles: SwitchRole { - name: "favoriteOrFirstNameSection" - filters: ValueFilter { - roleName: "favorite" - value: true - SwitchRole.value: "*" - } - defaultRoleName: "firstName" - } - } - \endcode - \sa FilterContainer -*/ -SwitchRoleAttached::SwitchRoleAttached(QObject* parent) : QObject (parent) -{ - if (!qobject_cast(parent)) - qmlInfo(parent) << "SwitchRole must be attached to a Filter"; -} - -/*! - \qmlattachedproperty var SwitchRole::value - - This property attaches a value to a \l Filter. -*/ -QVariant SwitchRoleAttached::value() const -{ - return m_value; -} - -void SwitchRoleAttached::setValue(QVariant value) -{ - if (m_value == value) - return; - - m_value = value; - Q_EMIT valueChanged(); -} - -/*! - \qmlproperty string SwitchRole::defaultRoleName - - This property holds the default role name of the role. - If no filter match a row, the data of this role will be the data of the role whose name is \c defaultRoleName. -*/ -QString SwitchRole::defaultRoleName() const -{ - return m_defaultRoleName; -} - -void SwitchRole::setDefaultRoleName(const QString& defaultRoleName) -{ - if (m_defaultRoleName == defaultRoleName) - return; - - m_defaultRoleName = defaultRoleName; - Q_EMIT defaultRoleNameChanged(); - invalidate(); -} - -/*! - \qmlproperty var SwitchRole::defaultValue - - This property holds the default value of the role. - If no filter match a row, and no \l defaultRoleName is set, the data of this role will be \c defaultValue. -*/ -QVariant SwitchRole::defaultValue() const -{ - return m_defaultValue; -} - -void SwitchRole::setDefaultValue(const QVariant& defaultValue) -{ - if (m_defaultValue == defaultValue) - return; - - m_defaultValue = defaultValue; - Q_EMIT defaultValueChanged(); - invalidate(); -} - -/*! - \qmlproperty list SwitchRole::filters - \default - - This property holds the list of filters for this proxy role. - The data of this role will be equal to the attached \l {value} {SwitchRole.value} property of the first filter that matches the model row. - - \sa Filter, FilterContainer -*/ - -void SwitchRole::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - for (Filter* filter : m_filters) - filter->proxyModelCompleted(proxyModel); -} - -SwitchRoleAttached* SwitchRole::qmlAttachedProperties(QObject* object) -{ - return new SwitchRoleAttached(object); -} - -QVariant SwitchRole::data(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel) -{ - for (auto filter: m_filters) { - if (!filter->enabled()) - continue; - if (filter->filterAcceptsRow(sourceIndex, proxyModel)) { - auto attached = static_cast(qmlAttachedPropertiesObject(filter, false)); - if (!attached) { - qWarning() << "No SwitchRole.value provided for this filter" << filter; - continue; - } - QVariant value = attached->value(); - if (!value.isValid()) { - qWarning() << "No SwitchRole.value provided for this filter" << filter; - continue; - } - return value; - } - } - if (!m_defaultRoleName.isEmpty()) - return proxyModel.sourceData(sourceIndex, m_defaultRoleName); - return m_defaultValue; -} - -void SwitchRole::onFilterAppended(Filter *filter) -{ - connect(filter, &Filter::invalidated, this, &SwitchRole::invalidate); - auto attached = static_cast(qmlAttachedPropertiesObject(filter, true)); - connect(attached, &SwitchRoleAttached::valueChanged, this, &SwitchRole::invalidate); - invalidate(); -} - -void SwitchRole::onFilterRemoved(Filter *filter) -{ - Q_UNUSED(filter) - invalidate(); -} - -void SwitchRole::onFiltersCleared() -{ - invalidate(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/proxyroles/switchrole.h b/client/3rd/SortFilterProxyModel/proxyroles/switchrole.h deleted file mode 100644 index 203a8ebd..00000000 --- a/client/3rd/SortFilterProxyModel/proxyroles/switchrole.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SWITCHROLE_H -#define SWITCHROLE_H - -#include "singlerole.h" -#include "filters/filtercontainer.h" -#include - -namespace qqsfpm { - -class SwitchRoleAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) -public: - SwitchRoleAttached(QObject* parent); - - QVariant value() const; - void setValue(QVariant value); - -Q_SIGNALS: - void valueChanged(); - -private: - QVariant m_value; -}; - -class SwitchRole : public SingleRole, public FilterContainer -{ - Q_OBJECT - Q_INTERFACES(qqsfpm::FilterContainer) - Q_PROPERTY(QString defaultRoleName READ defaultRoleName WRITE setDefaultRoleName NOTIFY defaultRoleNameChanged) - Q_PROPERTY(QVariant defaultValue READ defaultValue WRITE setDefaultValue NOTIFY defaultValueChanged) - Q_PROPERTY(QQmlListProperty filters READ filtersListProperty) - Q_CLASSINFO("DefaultProperty", "filters") - -public: - using SingleRole::SingleRole; - - QString defaultRoleName() const; - void setDefaultRoleName(const QString& defaultRoleName); - - QVariant defaultValue() const; - void setDefaultValue(const QVariant& defaultValue); - - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - - static SwitchRoleAttached* qmlAttachedProperties(QObject* object); - -Q_SIGNALS: - void defaultRoleNameChanged(); - void defaultValueChanged(); - -private: - QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) override; - - void onFilterAppended(Filter *filter) override; - void onFilterRemoved(Filter *filter) override; - void onFiltersCleared() override; - - QString m_defaultRoleName; - QVariant m_defaultValue; -}; - -} - -QML_DECLARE_TYPEINFO(qqsfpm::SwitchRole, QML_HAS_ATTACHED_PROPERTIES) - -#endif // SWITCHROLE_H diff --git a/client/3rd/SortFilterProxyModel/qpm.json b/client/3rd/SortFilterProxyModel/qpm.json deleted file mode 100644 index f1b15388..00000000 --- a/client/3rd/SortFilterProxyModel/qpm.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "fr.grecko.sortfilterproxymodel", - "description": "A nicely exposed QSortFilterProxyModel for QML", - "author": { - "name": "Pierre-Yves Siret", - "email": "gr3cko@gmail.com" - }, - "repository": { - "type": "GITHUB", - "url": "https://github.com/oKcerG/SortFilterProxyModel.git" - }, - "version": { - "label": "0.1.0", - "revision": "", - "fingerprint": "" - }, - "dependencies": [ - ], - "license": "MIT", - "pri_filename": "SortFilterProxyModel.pri", - "webpage": "" -} \ No newline at end of file diff --git a/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.cpp b/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.cpp deleted file mode 100644 index 6a3e77cf..00000000 --- a/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.cpp +++ /dev/null @@ -1,562 +0,0 @@ -#include "qqmlsortfilterproxymodel.h" -#include -#include -#include "filters/filter.h" -#include "sorters/sorter.h" -#include "proxyroles/proxyrole.h" - -namespace qqsfpm { - -/*! - \qmltype SortFilterProxyModel - \inqmlmodule SortFilterProxyModel - \ingroup SortFilterProxyModel - \ingroup FilterContainer - \ingroup SorterContainer - \brief Filters and sorts data coming from a source \l {http://doc.qt.io/qt-5/qabstractitemmodel.html} {QAbstractItemModel}. - - The SortFilterProxyModel type provides support for filtering and sorting data coming from a source model. - \sa FilterContainer, SorterContainer -*/ -QQmlSortFilterProxyModel::QQmlSortFilterProxyModel(QObject *parent) : - QSortFilterProxyModel(parent), -#ifdef SFPM_DELAYED - m_delayed(true) -#else - m_delayed(false) -#endif -{ - connect(this, &QAbstractProxyModel::sourceModelChanged, this, &QQmlSortFilterProxyModel::updateRoles); - connect(this, &QAbstractItemModel::modelReset, this, &QQmlSortFilterProxyModel::updateRoles); - connect(this, &QAbstractItemModel::rowsInserted, this, &QQmlSortFilterProxyModel::countChanged); - connect(this, &QAbstractItemModel::rowsRemoved, this, &QQmlSortFilterProxyModel::countChanged); - connect(this, &QAbstractItemModel::modelReset, this, &QQmlSortFilterProxyModel::countChanged); - connect(this, &QAbstractItemModel::layoutChanged, this, &QQmlSortFilterProxyModel::countChanged); - connect(this, &QAbstractItemModel::dataChanged, this, &QQmlSortFilterProxyModel::onDataChanged); - setDynamicSortFilter(true); -} - -/*! - \qmlproperty QAbstractItemModel* SortFilterProxyModel::sourceModel - - The source model of this proxy model -*/ - -/*! - \qmlproperty int SortFilterProxyModel::count - - The number of rows in the proxy model (not filtered out the source model) -*/ -int QQmlSortFilterProxyModel::count() const -{ - return rowCount(); -} - -/*! - \qmlproperty bool SortFilterProxyModel::delayed - - Delay the execution of filters, sorters and proxyRoles until the next event loop. - This can be used as an optimization when multiple filters, sorters or proxyRoles are changed in a single event loop. - They will be executed once in a single batch at the next event loop instead of being executed in multiple sequential batches. - - By default, the SortFilterProxyModel is not delayed, unless the \c SFPM_DELAYED environment variable is defined at compile time. -*/ -bool QQmlSortFilterProxyModel::delayed() const -{ - return m_delayed; -} - -void QQmlSortFilterProxyModel::setDelayed(bool delayed) -{ - if (m_delayed == delayed) - return; - - m_delayed = delayed; - Q_EMIT delayedChanged(); -} - -const QString& QQmlSortFilterProxyModel::filterRoleName() const -{ - return m_filterRoleName; -} - -void QQmlSortFilterProxyModel::setFilterRoleName(const QString& filterRoleName) -{ - if (m_filterRoleName == filterRoleName) - return; - - m_filterRoleName = filterRoleName; - updateFilterRole(); - Q_EMIT filterRoleNameChanged(); -} - -QString QQmlSortFilterProxyModel::filterPattern() const -{ - return filterRegularExpression().pattern(); -} - -void QQmlSortFilterProxyModel::setFilterPattern(const QString& filterPattern) -{ - QRegularExpression regExp = filterRegularExpression(); - if (regExp.pattern() == filterPattern) - return; - - regExp.setPattern(filterPattern); - QSortFilterProxyModel::setFilterRegularExpression(regExp); - Q_EMIT filterPatternChanged(); -} - -const QVariant& QQmlSortFilterProxyModel::filterValue() const -{ - return m_filterValue; -} - -void QQmlSortFilterProxyModel::setFilterValue(const QVariant& filterValue) -{ - if (m_filterValue == filterValue) - return; - - m_filterValue = filterValue; - queueInvalidateFilter(); - Q_EMIT filterValueChanged(); -} - -/*! - \qmlproperty string SortFilterProxyModel::sortRoleName - - The role name of the source model's data used for the sorting. - - \sa {http://doc.qt.io/qt-5/qsortfilterproxymodel.html#sortRole-prop} {sortRole}, roleForName -*/ -const QString& QQmlSortFilterProxyModel::sortRoleName() const -{ - return m_sortRoleName; -} - -void QQmlSortFilterProxyModel::setSortRoleName(const QString& sortRoleName) -{ - if (m_sortRoleName == sortRoleName) - return; - - m_sortRoleName = sortRoleName; - updateSortRole(); - Q_EMIT sortRoleNameChanged(); -} - -bool QQmlSortFilterProxyModel::ascendingSortOrder() const -{ - return m_ascendingSortOrder; -} - -void QQmlSortFilterProxyModel::setAscendingSortOrder(bool ascendingSortOrder) -{ - if (m_ascendingSortOrder == ascendingSortOrder) - return; - - m_ascendingSortOrder = ascendingSortOrder; - Q_EMIT ascendingSortOrderChanged(); - queueInvalidate(); -} - -/*! - \qmlproperty list SortFilterProxyModel::filters - - This property holds the list of filters for this proxy model. To be included in the model, a row of the source model has to be accepted by all the top level filters of this list. - - \sa Filter, FilterContainer -*/ - -/*! - \qmlproperty list SortFilterProxyModel::sorters - - This property holds the list of sorters for this proxy model. The rows of the source model are sorted by the sorters of this list, in their order of insertion. - - \sa Sorter, SorterContainer -*/ - -/*! - \qmlproperty list SortFilterProxyModel::proxyRoles - - This property holds the list of proxy roles for this proxy model. Each proxy role adds a new custom role to the model. - - \sa ProxyRole -*/ - -void QQmlSortFilterProxyModel::classBegin() -{ - -} - -void QQmlSortFilterProxyModel::componentComplete() -{ - m_completed = true; - - for (const auto& filter : m_filters) - filter->proxyModelCompleted(*this); - for (const auto& sorter : m_sorters) - sorter->proxyModelCompleted(*this); - for (const auto& proxyRole : m_proxyRoles) - proxyRole->proxyModelCompleted(*this); - - invalidate(); - sort(0); -} - -QVariant QQmlSortFilterProxyModel::sourceData(const QModelIndex& sourceIndex, const QString& roleName) const -{ - int role = roleNames().key(roleName.toUtf8()); - return sourceData(sourceIndex, role); -} - -QVariant QQmlSortFilterProxyModel::sourceData(const QModelIndex &sourceIndex, int role) const -{ - QPair proxyRolePair = m_proxyRoleMap[role]; - if (ProxyRole* proxyRole = proxyRolePair.first) - return proxyRole->roleData(sourceIndex, *this, proxyRolePair.second); - else - return sourceModel()->data(sourceIndex, role); -} - -QVariant QQmlSortFilterProxyModel::data(const QModelIndex &index, int role) const -{ - return sourceData(mapToSource(index), role); -} - -QHash QQmlSortFilterProxyModel::roleNames() const -{ - return m_roleNames.isEmpty() && sourceModel() ? sourceModel()->roleNames() : m_roleNames; -} - -/*! - \qmlmethod int SortFilterProxyModel::roleForName(string roleName) - - Returns the role number for the given \a roleName. - If no role is found for this \a roleName, \c -1 is returned. -*/ - -int QQmlSortFilterProxyModel::roleForName(const QString& roleName) const -{ - return m_roleNames.key(roleName.toUtf8(), -1); -} - -/*! - \qmlmethod object SortFilterProxyModel::get(int row) - - Return the item at \a row in the proxy model as a map of all its roles. This allows the item data to be read (not modified) from JavaScript. -*/ -QVariantMap QQmlSortFilterProxyModel::get(int row) const -{ - QVariantMap map; - QModelIndex modelIndex = index(row, 0); - QHash roles = roleNames(); - for (QHash::const_iterator it = roles.begin(); it != roles.end(); ++it) - map.insert(it.value(), data(modelIndex, it.key())); - return map; -} - -/*! - \qmlmethod variant SortFilterProxyModel::get(int row, string roleName) - - Return the data for the given \a roleName of the item at \a row in the proxy model. This allows the role data to be read (not modified) from JavaScript. - This equivalent to calling \c {data(index(row, 0), roleForName(roleName))}. -*/ -QVariant QQmlSortFilterProxyModel::get(int row, const QString& roleName) const -{ - return data(index(row, 0), roleForName(roleName)); -} - -/*! - \qmlmethod index SortFilterProxyModel::mapToSource(index proxyIndex) - - Returns the source model index corresponding to the given \a proxyIndex from the SortFilterProxyModel. -*/ -QModelIndex QQmlSortFilterProxyModel::mapToSource(const QModelIndex& proxyIndex) const -{ - return QSortFilterProxyModel::mapToSource(proxyIndex); -} - -/*! - \qmlmethod int SortFilterProxyModel::mapToSource(int proxyRow) - - Returns the source model row corresponding to the given \a proxyRow from the SortFilterProxyModel. - Returns -1 if there is no corresponding row. -*/ -int QQmlSortFilterProxyModel::mapToSource(int proxyRow) const -{ - QModelIndex proxyIndex = index(proxyRow, 0); - QModelIndex sourceIndex = mapToSource(proxyIndex); - return sourceIndex.isValid() ? sourceIndex.row() : -1; -} - -/*! - \qmlmethod QModelIndex SortFilterProxyModel::mapFromSource(QModelIndex sourceIndex) - - Returns the model index in the SortFilterProxyModel given the \a sourceIndex from the source model. -*/ -QModelIndex QQmlSortFilterProxyModel::mapFromSource(const QModelIndex& sourceIndex) const -{ - return QSortFilterProxyModel::mapFromSource(sourceIndex); -} - -/*! - \qmlmethod int SortFilterProxyModel::mapFromSource(int sourceRow) - - Returns the row in the SortFilterProxyModel given the \a sourceRow from the source model. - Returns -1 if there is no corresponding row. -*/ -int QQmlSortFilterProxyModel::mapFromSource(int sourceRow) const -{ - QModelIndex proxyIndex; - if (QAbstractItemModel* source = sourceModel()) { - QModelIndex sourceIndex = source->index(sourceRow, 0); - proxyIndex = mapFromSource(sourceIndex); - } - return proxyIndex.isValid() ? proxyIndex.row() : -1; -} - -bool QQmlSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const -{ - if (!m_completed) - return true; - QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent); - bool valueAccepted = !m_filterValue.isValid() || ( m_filterValue == sourceModel()->data(sourceIndex, filterRole()) ); - bool baseAcceptsRow = valueAccepted && QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); - baseAcceptsRow = baseAcceptsRow && std::all_of(m_filters.begin(), m_filters.end(), - [=, &source_parent] (Filter* filter) { - return filter->filterAcceptsRow(sourceIndex, *this); - } - ); - return baseAcceptsRow; -} - -bool QQmlSortFilterProxyModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const -{ - if (m_completed) { - if (!m_sortRoleName.isEmpty()) { - if (QSortFilterProxyModel::lessThan(source_left, source_right)) - return m_ascendingSortOrder; - if (QSortFilterProxyModel::lessThan(source_right, source_left)) - return !m_ascendingSortOrder; - } - auto sortedSorters = m_sorters; - std::stable_sort(sortedSorters.begin(), - sortedSorters.end(), - [] (Sorter* a, Sorter* b) { - return a->priority() > b->priority(); - }); - for(auto sorter : sortedSorters) { - if (sorter->enabled()) { - int comparison = sorter->compareRows(source_left, source_right, *this); - if (comparison != 0) - return comparison < 0; - } - } - } - return source_left.row() < source_right.row(); -} - -void QQmlSortFilterProxyModel::resetInternalData() -{ - QSortFilterProxyModel::resetInternalData(); - updateRoleNames(); -} - -void QQmlSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) -{ - if (sourceModel && sourceModel->roleNames().isEmpty()) { // workaround for when a model has no roles and roles are added when the model is populated (ListModel) - // QTBUG-57971 - connect(sourceModel, &QAbstractItemModel::rowsInserted, this, &QQmlSortFilterProxyModel::initRoles); - } - QSortFilterProxyModel::setSourceModel(sourceModel); -} - -void QQmlSortFilterProxyModel::queueInvalidateFilter() -{ - if (m_delayed) { - if (!m_invalidateFilterQueued && !m_invalidateQueued) { - m_invalidateFilterQueued = true; - QMetaObject::invokeMethod(this, "invalidateFilter", Qt::QueuedConnection); - } - } else { - invalidateFilter(); - } -} - -void QQmlSortFilterProxyModel::invalidateFilter() -{ - m_invalidateFilterQueued = false; - if (m_completed && !m_invalidateQueued) - QSortFilterProxyModel::invalidateFilter(); -} - -void QQmlSortFilterProxyModel::queueInvalidate() -{ - if (m_delayed) { - if (!m_invalidateQueued) { - m_invalidateQueued = true; - QMetaObject::invokeMethod(this, "invalidate", Qt::QueuedConnection); - } - } else { - invalidate(); - } -} - -void QQmlSortFilterProxyModel::invalidate() -{ - m_invalidateQueued = false; - if (m_completed) - QSortFilterProxyModel::invalidate(); -} - -void QQmlSortFilterProxyModel::updateRoleNames() -{ - if (!sourceModel()) - return; - m_roleNames = sourceModel()->roleNames(); - m_proxyRoleMap.clear(); - m_proxyRoleNumbers.clear(); - - auto roles = m_roleNames.keys(); - auto maxIt = std::max_element(roles.cbegin(), roles.cend()); - int maxRole = maxIt != roles.cend() ? *maxIt : -1; - for (auto proxyRole : m_proxyRoles) { - for (auto roleName : proxyRole->names()) { - ++maxRole; - m_roleNames[maxRole] = roleName.toUtf8(); - m_proxyRoleMap[maxRole] = {proxyRole, roleName}; - m_proxyRoleNumbers.append(maxRole); - } - } -} - -void QQmlSortFilterProxyModel::updateFilterRole() -{ - QList filterRoles = roleNames().keys(m_filterRoleName.toUtf8()); - if (!filterRoles.empty()) - { - setFilterRole(filterRoles.first()); - } -} - -void QQmlSortFilterProxyModel::updateSortRole() -{ - QList sortRoles = roleNames().keys(m_sortRoleName.toUtf8()); - if (!sortRoles.empty()) - { - setSortRole(sortRoles.first()); - queueInvalidate(); - } -} - -void QQmlSortFilterProxyModel::updateRoles() -{ - updateFilterRole(); - updateSortRole(); -} - -void QQmlSortFilterProxyModel::initRoles() -{ - disconnect(sourceModel(), &QAbstractItemModel::rowsInserted, this, &QQmlSortFilterProxyModel::initRoles); - resetInternalData(); - updateRoles(); -} - -void QQmlSortFilterProxyModel::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles) -{ - Q_UNUSED(roles); - if (!roles.isEmpty() && !m_proxyRoleNumbers.empty() && roles != m_proxyRoleNumbers) - Q_EMIT dataChanged(topLeft, bottomRight, m_proxyRoleNumbers); -} - -void QQmlSortFilterProxyModel::queueInvalidateProxyRoles() -{ - queueInvalidate(); - if (m_delayed) { - if (!m_invalidateProxyRolesQueued) { - m_invalidateProxyRolesQueued = true; - QMetaObject::invokeMethod(this, "invalidateProxyRoles", Qt::QueuedConnection); - } - } else { - invalidateProxyRoles(); - } -} - -void QQmlSortFilterProxyModel::invalidateProxyRoles() -{ - m_invalidateProxyRolesQueued = false; - if (m_completed) - Q_EMIT dataChanged(index(0,0), index(rowCount() - 1, columnCount() - 1), m_proxyRoleNumbers); -} - -QVariantMap QQmlSortFilterProxyModel::modelDataMap(const QModelIndex& modelIndex) const -{ - QVariantMap map; - QHash roles = roleNames(); - for (QHash::const_iterator it = roles.begin(); it != roles.end(); ++it) - map.insert(it.value(), sourceModel()->data(modelIndex, it.key())); - return map; -} - -void QQmlSortFilterProxyModel::onFilterAppended(Filter* filter) -{ - connect(filter, &Filter::invalidated, this, &QQmlSortFilterProxyModel::queueInvalidateFilter); - queueInvalidateFilter(); -} - -void QQmlSortFilterProxyModel::onFilterRemoved(Filter* filter) -{ - Q_UNUSED(filter) - queueInvalidateFilter(); -} - -void QQmlSortFilterProxyModel::onFiltersCleared() -{ - queueInvalidateFilter(); -} - -void QQmlSortFilterProxyModel::onSorterAppended(Sorter* sorter) -{ - connect(sorter, &Sorter::invalidated, this, &QQmlSortFilterProxyModel::queueInvalidate); - queueInvalidate(); -} - -void QQmlSortFilterProxyModel::onSorterRemoved(Sorter* sorter) -{ - Q_UNUSED(sorter) - queueInvalidate(); -} - -void QQmlSortFilterProxyModel::onSortersCleared() -{ - queueInvalidate(); -} - -void QQmlSortFilterProxyModel::onProxyRoleAppended(ProxyRole *proxyRole) -{ - beginResetModel(); - connect(proxyRole, &ProxyRole::invalidated, this, &QQmlSortFilterProxyModel::queueInvalidateProxyRoles); - connect(proxyRole, &ProxyRole::namesAboutToBeChanged, this, &QQmlSortFilterProxyModel::beginResetModel); - connect(proxyRole, &ProxyRole::namesChanged, this, &QQmlSortFilterProxyModel::endResetModel); - endResetModel(); -} - -void QQmlSortFilterProxyModel::onProxyRoleRemoved(ProxyRole *proxyRole) -{ - Q_UNUSED(proxyRole) - beginResetModel(); - endResetModel(); -} - -void QQmlSortFilterProxyModel::onProxyRolesCleared() -{ - beginResetModel(); - endResetModel(); -} - -void registerQQmlSortFilterProxyModelTypes() { - qmlRegisterType("SortFilterProxyModel", 0, 2, "SortFilterProxyModel"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerQQmlSortFilterProxyModelTypes) - -} diff --git a/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.h b/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.h deleted file mode 100644 index bf4f32e0..00000000 --- a/client/3rd/SortFilterProxyModel/qqmlsortfilterproxymodel.h +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef QQMLSORTFILTERPROXYMODEL_H -#define QQMLSORTFILTERPROXYMODEL_H - -#include -#include -#include "filters/filtercontainer.h" -#include "sorters/sortercontainer.h" -#include "proxyroles/proxyrolecontainer.h" - -namespace qqsfpm { - -class QQmlSortFilterProxyModel : public QSortFilterProxyModel, - public QQmlParserStatus, - public FilterContainer, - public SorterContainer, - public ProxyRoleContainer -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_INTERFACES(qqsfpm::FilterContainer) - Q_INTERFACES(qqsfpm::SorterContainer) - Q_INTERFACES(qqsfpm::ProxyRoleContainer) - - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(bool delayed READ delayed WRITE setDelayed NOTIFY delayedChanged) - - Q_PROPERTY(QString filterRoleName READ filterRoleName WRITE setFilterRoleName NOTIFY filterRoleNameChanged) - Q_PROPERTY(QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged) - Q_PROPERTY(QVariant filterValue READ filterValue WRITE setFilterValue NOTIFY filterValueChanged) - - Q_PROPERTY(QString sortRoleName READ sortRoleName WRITE setSortRoleName NOTIFY sortRoleNameChanged) - Q_PROPERTY(bool ascendingSortOrder READ ascendingSortOrder WRITE setAscendingSortOrder NOTIFY ascendingSortOrderChanged) - - Q_PROPERTY(QQmlListProperty filters READ filtersListProperty) - Q_PROPERTY(QQmlListProperty sorters READ sortersListProperty) - Q_PROPERTY(QQmlListProperty proxyRoles READ proxyRolesListProperty) - -public: - QQmlSortFilterProxyModel(QObject* parent = 0); - - int count() const; - - bool delayed() const; - void setDelayed(bool delayed); - - const QString& filterRoleName() const; - void setFilterRoleName(const QString& filterRoleName); - - QString filterPattern() const; - void setFilterPattern(const QString& filterPattern); - - const QVariant& filterValue() const; - void setFilterValue(const QVariant& filterValue); - - const QString& sortRoleName() const; - void setSortRoleName(const QString& sortRoleName); - - bool ascendingSortOrder() const; - void setAscendingSortOrder(bool ascendingSortOrder); - - void classBegin() override; - void componentComplete() override; - - QVariant sourceData(const QModelIndex& sourceIndex, const QString& roleName) const; - QVariant sourceData(const QModelIndex& sourceIndex, int role) const; - - QVariant data(const QModelIndex& index, int role) const override; - QHash roleNames() const override; - - Q_INVOKABLE int roleForName(const QString& roleName) const; - - Q_INVOKABLE QVariantMap get(int row) const; - Q_INVOKABLE QVariant get(int row, const QString& roleName) const; - - Q_INVOKABLE QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; - Q_INVOKABLE int mapToSource(int proxyRow) const; - Q_INVOKABLE QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; - Q_INVOKABLE int mapFromSource(int sourceRow) const; - - void setSourceModel(QAbstractItemModel *sourceModel) override; - -Q_SIGNALS: - void countChanged(); - void delayedChanged(); - - void filterRoleNameChanged(); - void filterPatternChanged(); - void filterValueChanged(); - - void sortRoleNameChanged(); - void ascendingSortOrderChanged(); - -protected: - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; - bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override; - -protected Q_SLOTS: - void resetInternalData() override; - -private Q_SLOTS: - void queueInvalidateFilter(); - void invalidateFilter(); - void queueInvalidate(); - void invalidate(); - void updateRoleNames(); - void updateFilterRole(); - void updateSortRole(); - void updateRoles(); - void initRoles(); - void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); - void queueInvalidateProxyRoles(); - void invalidateProxyRoles(); - -private: - QVariantMap modelDataMap(const QModelIndex& modelIndex) const; - - void onFilterAppended(Filter* filter) override; - void onFilterRemoved(Filter* filter) override; - void onFiltersCleared() override; - - void onSorterAppended(Sorter* sorter) override; - void onSorterRemoved(Sorter* sorter) override; - void onSortersCleared() override; - - void onProxyRoleAppended(ProxyRole *proxyRole) override; - void onProxyRoleRemoved(ProxyRole *proxyRole) override; - void onProxyRolesCleared() override; - - bool m_delayed; - QString m_filterRoleName; - QVariant m_filterValue; - QString m_sortRoleName; - bool m_ascendingSortOrder = true; - bool m_completed = false; - QHash m_roleNames; - QHash> m_proxyRoleMap; - QVector m_proxyRoleNumbers; - - bool m_invalidateFilterQueued = false; - bool m_invalidateQueued = false; - bool m_invalidateProxyRolesQueued = false; -}; - -} - -#endif // QQMLSORTFILTERPROXYMODEL_H diff --git a/client/3rd/SortFilterProxyModel/sorters/expressionsorter.cpp b/client/3rd/SortFilterProxyModel/sorters/expressionsorter.cpp deleted file mode 100644 index 7bb92067..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/expressionsorter.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "expressionsorter.h" -#include "qqmlsortfilterproxymodel.h" -#include - -namespace qqsfpm { - -/*! - \qmltype ExpressionSorter - \inherits Sorter - \inqmlmodule SortFilterProxyModel - \ingroup Sorters - \brief Sorts row with a custom javascript expression. - - An ExpressionSorter is a \l Sorter allowing to implement custom sorting based on a javascript expression. -*/ - -/*! - \qmlproperty expression ExpressionSorter::expression - - An expression to implement custom sorting. It must evaluate to a bool. - It has the same syntax has a \l {http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html} {Property Binding}, except that it will be evaluated for each of the source model's rows. - Model data is accessible for both rows with the \c modelLeft, and \c modelRight properties: - - \code - sorters: ExpressionSorter { - expression: { - return modelLeft.someRole < modelRight.someRole; - } - } - \endcode - - The \c index of the row is also available through \c modelLeft and \c modelRight. - - The expression should return \c true if the value of the left item is less than the value of the right item, otherwise returns false. - - This expression is reevaluated for a row every time its model data changes. - When an external property (not \c index* or in \c model*) the expression depends on changes, the expression is reevaluated for every row of the source model. - To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. - This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes. - - A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression. -*/ -const QQmlScriptString& ExpressionSorter::expression() const -{ - return m_scriptString; -} - -void ExpressionSorter::setExpression(const QQmlScriptString& scriptString) -{ - if (m_scriptString == scriptString) - return; - - m_scriptString = scriptString; - updateExpression(); - - Q_EMIT expressionChanged(); - invalidate(); -} - -void ExpressionSorter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - updateContext(proxyModel); -} - -bool evaluateBoolExpression(QQmlExpression& expression) -{ - QVariant variantResult = expression.evaluate(); - if (expression.hasError()) { - qWarning() << expression.error(); - return false; - } - if (variantResult.canConvert()) { - return variantResult.toBool(); - } else { - qWarning("%s:%i:%i : Can't convert result to bool", - expression.sourceFile().toUtf8().data(), - expression.lineNumber(), - expression.columnNumber()); - return false; - } -} - -int ExpressionSorter::compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - if (!m_scriptString.isEmpty()) { - QVariantMap modelLeftMap, modelRightMap; - QHash roles = proxyModel.roleNames(); - - QQmlContext context(qmlContext(this)); - - for (auto it = roles.cbegin(); it != roles.cend(); ++it) { - modelLeftMap.insert(it.value(), proxyModel.sourceData(sourceLeft, it.key())); - modelRightMap.insert(it.value(), proxyModel.sourceData(sourceRight, it.key())); - } - modelLeftMap.insert("index", sourceLeft.row()); - modelRightMap.insert("index", sourceRight.row()); - - QQmlExpression expression(m_scriptString, &context); - - context.setContextProperty("modelLeft", modelLeftMap); - context.setContextProperty("modelRight", modelRightMap); - if (evaluateBoolExpression(expression)) - return -1; - - context.setContextProperty("modelLeft", modelRightMap); - context.setContextProperty("modelRight", modelLeftMap); - if (evaluateBoolExpression(expression)) - return 1; - } - return 0; -} - -void ExpressionSorter::updateContext(const QQmlSortFilterProxyModel& proxyModel) -{ - delete m_context; - m_context = new QQmlContext(qmlContext(this), this); - - QVariantMap modelLeftMap, modelRightMap; - // what about roles changes ? - - for (const QByteArray& roleName : proxyModel.roleNames().values()) { - modelLeftMap.insert(roleName, QVariant()); - modelRightMap.insert(roleName, QVariant()); - } - modelLeftMap.insert("index", -1); - modelRightMap.insert("index", -1); - - m_context->setContextProperty("modelLeft", modelLeftMap); - m_context->setContextProperty("modelRight", modelRightMap); - - updateExpression(); -} - -void ExpressionSorter::updateExpression() -{ - if (!m_context) - return; - - delete m_expression; - m_expression = new QQmlExpression(m_scriptString, m_context, 0, this); - connect(m_expression, &QQmlExpression::valueChanged, this, &ExpressionSorter::invalidate); - m_expression->setNotifyOnValueChanged(true); - m_expression->evaluate(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/expressionsorter.h b/client/3rd/SortFilterProxyModel/sorters/expressionsorter.h deleted file mode 100644 index 6ca17fd0..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/expressionsorter.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef EXPRESSIONSORTER_H -#define EXPRESSIONSORTER_H - -#include "sorter.h" -#include - -class QQmlExpression; - -namespace qqsfpm { - -class QQmlSortFilterProxyModel; - -class ExpressionSorter : public Sorter -{ - Q_OBJECT - Q_PROPERTY(QQmlScriptString expression READ expression WRITE setExpression NOTIFY expressionChanged) - -public: - using Sorter::Sorter; - - const QQmlScriptString& expression() const; - void setExpression(const QQmlScriptString& scriptString); - - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - -Q_SIGNALS: - void expressionChanged(); - -protected: - int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const override; - -private: - void updateContext(const QQmlSortFilterProxyModel& proxyModel); - void updateExpression(); - - QQmlScriptString m_scriptString; - QQmlExpression* m_expression = nullptr; - QQmlContext* m_context = nullptr; -}; - -} - -#endif // EXPRESSIONSORTER_H diff --git a/client/3rd/SortFilterProxyModel/sorters/filtersorter.cpp b/client/3rd/SortFilterProxyModel/sorters/filtersorter.cpp deleted file mode 100644 index 185c5043..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/filtersorter.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "filtersorter.h" -#include "filters/filter.h" - -namespace qqsfpm { - -/*! - \qmltype FilterSorter - \inherits Sorter - \inqmlmodule SortFilterProxyModel - \ingroup Sorters - \ingroup FilterContainer - \brief Sorts rows based on if they match filters. - - A FilterSorter is a \l Sorter that orders row matching its filters before the rows not matching the filters. - - In the following example, rows with their \c favorite role set to \c true will be ordered at the beginning : - \code - SortFilterProxyModel { - sourceModel: contactModel - sorters: FilterSorter { - ValueFilter { roleName: "favorite"; value: true } - } - } - \endcode - \sa FilterContainer -*/ - -/*! - \qmlproperty list FilterSorter::filters - \default - - This property holds the list of filters for this filter sorter. - If a row match all this FilterSorter's filters, it will be ordered before rows not matching all the filters. - - \sa Filter, FilterContainer -*/ - -int FilterSorter::compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel &proxyModel) const -{ - bool leftIsAccepted = indexIsAccepted(sourceLeft, proxyModel); - bool rightIsAccepted = indexIsAccepted(sourceRight, proxyModel); - - if (leftIsAccepted == rightIsAccepted) - return 0; - - return leftIsAccepted ? -1 : 1; -} - -void FilterSorter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - for (Filter* filter : m_filters) - filter->proxyModelCompleted(proxyModel); -} - -void FilterSorter::onFilterAppended(Filter* filter) -{ - connect(filter, &Filter::invalidated, this, &FilterSorter::invalidate); - invalidate(); -} - -void FilterSorter::onFilterRemoved(Filter* filter) -{ - disconnect(filter, &Filter::invalidated, this, &FilterSorter::invalidate); - invalidate(); -} - -void FilterSorter::onFiltersCleared() -{ - invalidate(); -} - -bool FilterSorter::indexIsAccepted(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const -{ - return std::all_of(m_filters.begin(), m_filters.end(), - [&] (Filter* filter) { - return filter->filterAcceptsRow(sourceIndex, proxyModel); - } - ); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/filtersorter.h b/client/3rd/SortFilterProxyModel/sorters/filtersorter.h deleted file mode 100644 index b1406438..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/filtersorter.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef FILTERSORTER_H -#define FILTERSORTER_H - -#include "sorter.h" -#include "filters/filtercontainer.h" - -namespace qqsfpm { - -class FilterSorter : public Sorter, public FilterContainer -{ - Q_OBJECT - Q_INTERFACES(qqsfpm::FilterContainer) - Q_PROPERTY(QQmlListProperty filters READ filtersListProperty) - Q_CLASSINFO("DefaultProperty", "filters") - -public: - using Sorter::Sorter; - -protected: - int compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel &proxyModel) const override; - -private: - void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; - void onFilterAppended(Filter *filter) override; - void onFilterRemoved(Filter *filter) override; - void onFiltersCleared() override; - - bool indexIsAccepted(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel) const; -}; - -} - -#endif // FILTERSORTER_H diff --git a/client/3rd/SortFilterProxyModel/sorters/rolesorter.cpp b/client/3rd/SortFilterProxyModel/sorters/rolesorter.cpp deleted file mode 100644 index d98e9b14..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/rolesorter.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "rolesorter.h" -#include "qqmlsortfilterproxymodel.h" -#include "../utils/utils.h" - -namespace qqsfpm { - -/*! - \qmltype RoleSorter - \inherits Sorter - \inqmlmodule SortFilterProxyModel - \ingroup Sorters - \brief Sorts rows based on a source model role. - - A RoleSorter is a simple \l Sorter that sorts rows based on a source model role. - - In the following example, rows with be sorted by their \c lastName role : - \code - SortFilterProxyModel { - sourceModel: contactModel - sorters: RoleSorter { roleName: "lastName" } - } - \endcode -*/ - -/*! - \qmlproperty string RoleSorter::roleName - - This property holds the role name that the sorter is using to query the source model's data when sorting items. -*/ -const QString& RoleSorter::roleName() const -{ - return m_roleName; -} - -void RoleSorter::setRoleName(const QString& roleName) -{ - if (m_roleName == roleName) - return; - - m_roleName = roleName; - Q_EMIT roleNameChanged(); - invalidate(); -} - -QPair RoleSorter::sourceData(const QModelIndex &sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - QPair pair; - int role = proxyModel.roleForName(m_roleName); - - if (role == -1) - return pair; - - pair.first = proxyModel.sourceData(sourceLeft, role); - pair.second = proxyModel.sourceData(sourceRight, role); - return pair; -} - -int RoleSorter::compare(const QModelIndex &sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - const QPair pair = sourceData(sourceLeft, sourceRight, proxyModel); - return compareVariants(pair.first, pair.second); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/rolesorter.h b/client/3rd/SortFilterProxyModel/sorters/rolesorter.h deleted file mode 100644 index 9cc11bd1..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/rolesorter.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef ROLESORTER_H -#define ROLESORTER_H - -#include "sorter.h" - -namespace qqsfpm { - -class RoleSorter : public Sorter -{ - Q_OBJECT - Q_PROPERTY(QString roleName READ roleName WRITE setRoleName NOTIFY roleNameChanged) - -public: - using Sorter::Sorter; - - const QString& roleName() const; - void setRoleName(const QString& roleName); - -Q_SIGNALS: - void roleNameChanged(); - -protected: - QPair sourceData(const QModelIndex &sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const; - int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const override; - -private: - QString m_roleName; -}; - -} - -#endif // ROLESORTER_H diff --git a/client/3rd/SortFilterProxyModel/sorters/sorter.cpp b/client/3rd/SortFilterProxyModel/sorters/sorter.cpp deleted file mode 100644 index e9d05479..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/sorter.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "sorter.h" -#include "qqmlsortfilterproxymodel.h" - -namespace qqsfpm { - -/*! - \qmltype Sorter - \qmlabstract - \inqmlmodule SortFilterProxyModel - \ingroup Sorters - \brief Base type for the \l SortFilterProxyModel sorters. - - The Sorter type cannot be used directly in a QML file. - It exists to provide a set of common properties and methods, - available across all the other sorters types that inherit from it. - Attempting to use the Sorter type directly will result in an error. -*/ - -Sorter::Sorter(QObject *parent) : QObject(parent) -{ -} - -Sorter::~Sorter() = default; - -/*! - \qmlproperty bool Sorter::enabled - - This property holds whether the sorter is enabled. - A disabled sorter will not change the order of the rows. - - By default, sorters are enabled. -*/ -bool Sorter::enabled() const -{ - return m_enabled; -} - -void Sorter::setEnabled(bool enabled) -{ - if (m_enabled == enabled) - return; - - m_enabled = enabled; - Q_EMIT enabledChanged(); - Q_EMIT invalidated(); -} - -bool Sorter::ascendingOrder() const -{ - return sortOrder() == Qt::AscendingOrder; -} - -void Sorter::setAscendingOrder(bool ascendingOrder) -{ - setSortOrder(ascendingOrder ? Qt::AscendingOrder : Qt::DescendingOrder); -} - - -/*! - \qmlproperty Qt::SortOrder Sorter::sortOrder - - This property holds the sort order of this sorter. - - \value Qt.AscendingOrder The items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales - \value Qt.DescendingOrder The items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales - - By default, sorting is in ascending order. -*/ -Qt::SortOrder Sorter::sortOrder() const -{ - return m_sortOrder; -} - -void Sorter::setSortOrder(Qt::SortOrder sortOrder) -{ - if (m_sortOrder == sortOrder) - return; - - m_sortOrder = sortOrder; - Q_EMIT sortOrderChanged(); - invalidate(); -} - -/*! - \qmlproperty int Sorter::priority - - This property holds the sort priority of this sorter. - Sorters with a higher priority are applied first. - In case of equal priority, Sorters are ordered by their insertion order. - - By default, the priority is 0. -*/ -int Sorter::priority() const -{ - return m_priority; -} - -void Sorter::setPriority(int priority) -{ - if (m_priority == priority) - return; - - m_priority = priority; - Q_EMIT priorityChanged(); - invalidate(); -} - -int Sorter::compareRows(const QModelIndex &source_left, const QModelIndex &source_right, const QQmlSortFilterProxyModel& proxyModel) const -{ - int comparison = compare(source_left, source_right, proxyModel); - return (m_sortOrder == Qt::AscendingOrder) ? comparison : -comparison; -} - -int Sorter::compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - if (lessThan(sourceLeft, sourceRight, proxyModel)) - return -1; - if (lessThan(sourceRight, sourceLeft, proxyModel)) - return 1; - return 0; -} - -void Sorter::proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) -{ - Q_UNUSED(proxyModel) -} - -bool Sorter::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - Q_UNUSED(sourceLeft) - Q_UNUSED(sourceRight) - Q_UNUSED(proxyModel) - return false; -} - -void Sorter::invalidate() -{ - if (m_enabled) - Q_EMIT invalidated(); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/sorter.h b/client/3rd/SortFilterProxyModel/sorters/sorter.h deleted file mode 100644 index f7ecd886..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/sorter.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef SORTER_H -#define SORTER_H - -#include - -namespace qqsfpm { - -class QQmlSortFilterProxyModel; - -class Sorter : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(bool ascendingOrder READ ascendingOrder WRITE setAscendingOrder NOTIFY sortOrderChanged) - Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) - Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged) - -public: - Sorter(QObject* parent = nullptr); - virtual ~Sorter() = 0; - - bool enabled() const; - void setEnabled(bool enabled); - - bool ascendingOrder() const; - void setAscendingOrder(bool ascendingOrder); - - Qt::SortOrder sortOrder() const; - void setSortOrder(Qt::SortOrder sortOrder); - - int priority() const; - void setPriority(int priority); - - int compareRows(const QModelIndex& source_left, const QModelIndex& source_right, const QQmlSortFilterProxyModel& proxyModel) const; - - virtual void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel); - -Q_SIGNALS: - void enabledChanged(); - void sortOrderChanged(); - void priorityChanged(); - - void invalidated(); - -protected: - virtual int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const; - virtual bool lessThan(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const; - void invalidate(); - -private: - bool m_enabled = true; - Qt::SortOrder m_sortOrder = Qt::AscendingOrder; - int m_priority = 0; -}; - -} - -#endif // SORTER_H diff --git a/client/3rd/SortFilterProxyModel/sorters/sortercontainer.cpp b/client/3rd/SortFilterProxyModel/sorters/sortercontainer.cpp deleted file mode 100644 index 5255e294..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/sortercontainer.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "sortercontainer.h" -#include "sorter.h" -#include - -namespace qqsfpm { - -/*! - \qmltype SorterContainer - \qmlabstract - \inqmlmodule SortFilterProxyModel - \ingroup SorterAttached - \brief Abstract interface for types containing \l {Sorter}{Sorters}. - - \section2 Types implementing this interface: - \annotatedlist SorterContainer -*/ - -QList SorterContainer::sorters() const -{ - return m_sorters; -} - -void SorterContainer::appendSorter(Sorter* sorter) -{ - m_sorters.append(sorter); - onSorterAppended(sorter); -} - -void SorterContainer::removeSorter(Sorter *sorter) -{ - m_sorters.removeOne(sorter); - onSorterRemoved(sorter); -} - -void SorterContainer::clearSorters() -{ - m_sorters.clear(); - onSortersCleared(); -} - -QQmlListProperty SorterContainer::sortersListProperty() -{ - return QQmlListProperty(reinterpret_cast(this), &m_sorters, - &SorterContainer::append_sorter, - &SorterContainer::count_sorter, - &SorterContainer::at_sorter, - &SorterContainer::clear_sorters); -} - -void SorterContainer::append_sorter(QQmlListProperty* list, Sorter* sorter) -{ - if (!sorter) - return; - - SorterContainer* that = reinterpret_cast(list->object); - that->appendSorter(sorter); -} - -qsizetype SorterContainer::count_sorter(QQmlListProperty* list) -{ - QList* sorters = static_cast*>(list->data); - return sorters->count(); -} - -Sorter* SorterContainer::at_sorter(QQmlListProperty* list, qsizetype index) -{ - QList* sorters = static_cast*>(list->data); - return sorters->at(index); -} - -void SorterContainer::clear_sorters(QQmlListProperty *list) -{ - SorterContainer* that = reinterpret_cast(list->object); - that->clearSorters(); -} - -SorterContainerAttached::SorterContainerAttached(QObject* object) : QObject(object), - m_sorter(qobject_cast(object)) -{ - if (!m_sorter) - qmlWarning(object) << "SorterContainerAttached must be attached to a Sorter"; -} - -SorterContainerAttached::~SorterContainerAttached() -{ - if (m_sorter && m_container) { - SorterContainer* container = qobject_cast(m_container.data()); - container->removeSorter(m_sorter); - } -} - -/*! - \qmlattachedproperty bool SorterContainer::container - This attached property allows you to include in a \l SorterContainer a \l Sorter that - has been instantiated outside of the \l SorterContainer, for example in an Instantiator. -*/ -QObject* SorterContainerAttached::container() const -{ - return m_container; -} - -void SorterContainerAttached::setContainer(QObject* object) -{ - if (m_container == object) - return; - - SorterContainer* container = qobject_cast(object); - if (object && !container) - qmlWarning(parent()) << "container must inherits from SorterContainer, " << object->metaObject()->className() << " provided"; - - if (m_container && m_sorter) - qobject_cast(m_container.data())->removeSorter(m_sorter); - - m_container = container ? object : nullptr; - if (container && m_sorter) - container->appendSorter(m_sorter); - - Q_EMIT containerChanged(); -} - -SorterContainerAttached* SorterContainerAttached::qmlAttachedProperties(QObject* object) -{ - return new SorterContainerAttached(object); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/sortercontainer.h b/client/3rd/SortFilterProxyModel/sorters/sortercontainer.h deleted file mode 100644 index c60a067c..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/sortercontainer.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SORTERSSORTERCONTAINER_H -#define SORTERSSORTERCONTAINER_H - -#include -#include -#include -#include - -namespace qqsfpm { - -class Sorter; -class QQmlSortFilterProxyModel; - -class SorterContainer { -public: - virtual ~SorterContainer() = default; - - QList sorters() const; - void appendSorter(Sorter* sorter); - void removeSorter(Sorter* sorter); - void clearSorters(); - - QQmlListProperty sortersListProperty(); - -protected: - QList m_sorters; - -private: - virtual void onSorterAppended(Sorter* sorter) = 0; - virtual void onSorterRemoved(Sorter* sorter) = 0; - virtual void onSortersCleared() = 0; - - static void append_sorter(QQmlListProperty* list, Sorter* sorter); - static qsizetype count_sorter(QQmlListProperty* list); - static Sorter* at_sorter(QQmlListProperty* list, qsizetype index); - static void clear_sorters(QQmlListProperty* list); -}; - -class SorterContainerAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QObject* container READ container WRITE setContainer NOTIFY containerChanged) - -public: - SorterContainerAttached(QObject* object); - ~SorterContainerAttached(); - - QObject* container() const; - void setContainer(QObject* object); - - static SorterContainerAttached* qmlAttachedProperties(QObject* object); - -Q_SIGNALS: - void containerChanged(); - -private: - QPointer m_container = nullptr; - Sorter* m_sorter = nullptr; -}; - -} - -#define SorterContainer_iid "fr.grecko.SortFilterProxyModel.SorterContainer" -Q_DECLARE_INTERFACE(qqsfpm::SorterContainer, SorterContainer_iid) - -QML_DECLARE_TYPEINFO(qqsfpm::SorterContainerAttached, QML_HAS_ATTACHED_PROPERTIES) - -#endif // SORTERSSORTERCONTAINER_H diff --git a/client/3rd/SortFilterProxyModel/sorters/sortersqmltypes.cpp b/client/3rd/SortFilterProxyModel/sorters/sortersqmltypes.cpp deleted file mode 100644 index ceba4237..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/sortersqmltypes.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "sorter.h" -#include "rolesorter.h" -#include "stringsorter.h" -#include "filtersorter.h" -#include "expressionsorter.h" -#include "sortercontainer.h" -#include -#include - -namespace qqsfpm { - -void registerSorterTypes() { - qmlRegisterUncreatableType("SortFilterProxyModel", 0, 2, "Sorter", "Sorter is an abstract class"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "RoleSorter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "StringSorter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "FilterSorter"); - qmlRegisterType("SortFilterProxyModel", 0, 2, "ExpressionSorter"); - qmlRegisterUncreatableType("SortFilterProxyModel", 0, 2, "SorterContainer", "SorterContainer can only be used as an attaching type"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerSorterTypes) - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/stringsorter.cpp b/client/3rd/SortFilterProxyModel/sorters/stringsorter.cpp deleted file mode 100644 index 0c331d05..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/stringsorter.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "stringsorter.h" - -namespace qqsfpm { - -/*! - \qmltype StringSorter - \inherits RoleSorter - \inqmlmodule SortFilterProxyModel - \ingroup Sorters - \brief Sorts rows based on a source model string role. - - \l StringSorter is a specialized \l RoleSorter that sorts rows based on a source model string role. - \l StringSorter compares strings according to a localized collation algorithm. - - In the following example, rows with be sorted by their \c lastName role : - \code - SortFilterProxyModel { - sourceModel: contactModel - sorters: StringSorter { roleName: "lastName" } - } - \endcode -*/ - -/*! - \qmlproperty Qt.CaseSensitivity StringSorter::caseSensitivity - - This property holds the case sensitivity of the sorter. -*/ -Qt::CaseSensitivity StringSorter::caseSensitivity() const -{ - return m_collator.caseSensitivity(); -} - -void StringSorter::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity) -{ - if (m_collator.caseSensitivity() == caseSensitivity) - return; - - m_collator.setCaseSensitivity(caseSensitivity); - Q_EMIT caseSensitivityChanged(); - invalidate(); -} - -/*! - \qmlproperty bool StringSorter::ignorePunctation - - This property holds whether the sorter ignores punctation. - if \c ignorePunctuation is \c true, punctuation characters and symbols are ignored when determining sort order. - - \note This property is not currently supported on Apple platforms or if Qt is configured to not use ICU on Linux. -*/ -bool StringSorter::ignorePunctation() const -{ - return m_collator.ignorePunctuation(); -} - -void StringSorter::setIgnorePunctation(bool ignorePunctation) -{ - if (m_collator.ignorePunctuation() == ignorePunctation) - return; - - m_collator.setIgnorePunctuation(ignorePunctation); - Q_EMIT ignorePunctationChanged(); - invalidate(); -} - -/*! - \qmlproperty Locale StringSorter::locale - - This property holds the locale of the sorter. -*/ -QLocale StringSorter::locale() const -{ - return m_collator.locale(); -} - -void StringSorter::setLocale(const QLocale &locale) -{ - if (m_collator.locale() == locale) - return; - - m_collator.setLocale(locale); - Q_EMIT localeChanged(); - invalidate(); -} - -/*! - \qmlproperty bool StringSorter::numericMode - - This property holds whether the numeric mode of the sorter is enabled. - This will enable proper sorting of numeric digits, so that e.g. 100 sorts after 99. - By default this mode is off. -*/ -bool StringSorter::numericMode() const -{ - return m_collator.numericMode(); -} - -void StringSorter::setNumericMode(bool numericMode) -{ - if (m_collator.numericMode() == numericMode) - return; - - m_collator.setNumericMode(numericMode); - Q_EMIT numericModeChanged(); - invalidate(); -} - -int StringSorter::compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel& proxyModel) const -{ - QPair pair = sourceData(sourceLeft, sourceRight, proxyModel); - QString leftValue = pair.first.toString(); - QString rightValue = pair.second.toString(); - return m_collator.compare(leftValue, rightValue); -} - -} diff --git a/client/3rd/SortFilterProxyModel/sorters/stringsorter.h b/client/3rd/SortFilterProxyModel/sorters/stringsorter.h deleted file mode 100644 index 3368482a..00000000 --- a/client/3rd/SortFilterProxyModel/sorters/stringsorter.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef STRINGSORTER_H -#define STRINGSORTER_H - -#include "rolesorter.h" -#include - -namespace qqsfpm { - -class StringSorter : public RoleSorter -{ - Q_OBJECT - Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity NOTIFY caseSensitivityChanged) - Q_PROPERTY(bool ignorePunctation READ ignorePunctation WRITE setIgnorePunctation NOTIFY ignorePunctationChanged) - Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged) - Q_PROPERTY(bool numericMode READ numericMode WRITE setNumericMode NOTIFY numericModeChanged) - -public: - using RoleSorter::RoleSorter; - - Qt::CaseSensitivity caseSensitivity() const; - void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); - - bool ignorePunctation() const; - void setIgnorePunctation(bool ignorePunctation); - - QLocale locale() const; - void setLocale(const QLocale& locale); - - bool numericMode() const; - void setNumericMode(bool numericMode); - -Q_SIGNALS: - void caseSensitivityChanged(); - void ignorePunctationChanged(); - void localeChanged(); - void numericModeChanged(); - -protected: - int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const QQmlSortFilterProxyModel& proxyModel) const override; - -private: - QCollator m_collator; -}; - -} - -#endif // STRINGSORTER_H diff --git a/client/3rd/SortFilterProxyModel/sortfilterproxymodel.qdocconf b/client/3rd/SortFilterProxyModel/sortfilterproxymodel.qdocconf deleted file mode 100644 index 7a3a6532..00000000 --- a/client/3rd/SortFilterProxyModel/sortfilterproxymodel.qdocconf +++ /dev/null @@ -1,13 +0,0 @@ -project = SortFilterProxyModel - -sourcedirs = . - -sources.fileextensions = "*.cpp *.qdoc *.qml" -headers.fileextensions = "*.h" - -outputdir = docs/ - -HTML.templatedir = . -HTML.stylesheets = "offline.css" - -HTML.headerstyles = " \n" diff --git a/client/3rd/SortFilterProxyModel/tests/BLACKLIST b/client/3rd/SortFilterProxyModel/tests/BLACKLIST deleted file mode 100644 index f881ba04..00000000 --- a/client/3rd/SortFilterProxyModel/tests/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[StringSorterTests::test_stringSorters:doNotIgnorePunctuation] -macos diff --git a/client/3rd/SortFilterProxyModel/tests/SortFilterProxyModel.pro b/client/3rd/SortFilterProxyModel/tests/SortFilterProxyModel.pro deleted file mode 100644 index 69fd5834..00000000 --- a/client/3rd/SortFilterProxyModel/tests/SortFilterProxyModel.pro +++ /dev/null @@ -1,36 +0,0 @@ -TEMPLATE = app -TARGET = tst_sortfilterproxymodel -QT += qml quick -CONFIG += c++11 warn_on qmltestcase qml_debug no_keywords - -include(../SortFilterProxyModel.pri) - -HEADERS += \ - indexsorter.h \ - testroles.h - -SOURCES += \ - tst_sortfilterproxymodel.cpp \ - indexsorter.cpp \ - testroles.cpp - -OTHER_FILES += \ - tst_rangefilter.qml \ - tst_indexfilter.qml \ - tst_sourceroles.qml \ - tst_sorters.qml \ - tst_helpers.qml \ - tst_builtins.qml \ - tst_rolesorter.qml \ - tst_stringsorter.qml \ - tst_proxyroles.qml \ - tst_joinrole.qml \ - tst_switchrole.qml \ - tst_expressionrole.qml \ - tst_filtercontainerattached.qml \ - tst_filtercontainers.qml \ - tst_regexprole.qml \ - tst_filtersorter.qml \ - tst_filterrole.qml \ - tst_delayed.qml \ - tst_sortercontainerattached.qml diff --git a/client/3rd/SortFilterProxyModel/tests/indexsorter.cpp b/client/3rd/SortFilterProxyModel/tests/indexsorter.cpp deleted file mode 100644 index 38c295c2..00000000 --- a/client/3rd/SortFilterProxyModel/tests/indexsorter.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "indexsorter.h" -#include - -int IndexSorter::compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) const -{ - Q_UNUSED(proxyModel) - return sourceLeft.row() - sourceRight.row(); -} - -int ReverseIndexSorter::compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) const -{ - Q_UNUSED(proxyModel) - return sourceRight.row() - sourceLeft.row(); -} - -void registerIndexSorterTypes() { - qmlRegisterType("SortFilterProxyModel.Test", 0, 2, "IndexSorter"); - qmlRegisterType("SortFilterProxyModel.Test", 0, 2, "ReverseIndexSorter"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerIndexSorterTypes) diff --git a/client/3rd/SortFilterProxyModel/tests/indexsorter.h b/client/3rd/SortFilterProxyModel/tests/indexsorter.h deleted file mode 100644 index 2169df29..00000000 --- a/client/3rd/SortFilterProxyModel/tests/indexsorter.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef INDEXSORTER_H -#define INDEXSORTER_H - -#include "sorters/sorter.h" - -class IndexSorter : public qqsfpm::Sorter -{ -public: - using qqsfpm::Sorter::Sorter; - int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) const override; -}; - -class ReverseIndexSorter : public qqsfpm::Sorter -{ -public: - using qqsfpm::Sorter::Sorter; - int compare(const QModelIndex& sourceLeft, const QModelIndex& sourceRight, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) const override; -}; - -#endif // INDEXSORTER_H diff --git a/client/3rd/SortFilterProxyModel/tests/testroles.cpp b/client/3rd/SortFilterProxyModel/tests/testroles.cpp deleted file mode 100644 index 18c0c2c8..00000000 --- a/client/3rd/SortFilterProxyModel/tests/testroles.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "testroles.h" -#include - -QVariant StaticRole::value() const -{ - return m_value; -} - -void StaticRole::setValue(const QVariant& value) -{ - if (m_value == value) - return; - - m_value = value; - Q_EMIT valueChanged(); - invalidate(); -} - -QVariant StaticRole::data(const QModelIndex& sourceIndex, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) -{ - Q_UNUSED(sourceIndex) - Q_UNUSED(proxyModel) - return m_value; -} - -QVariant SourceIndexRole::data(const QModelIndex& sourceIndex, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) -{ - Q_UNUSED(proxyModel) - return sourceIndex.row(); -} - -QStringList MultiRole::names() -{ - return {"role1", "role2"}; -} - -QVariant MultiRole::data(const QModelIndex&, const qqsfpm::QQmlSortFilterProxyModel&, const QString& name) -{ - return "data for " + name; -} - -void registerTestRolesTypes() { - qmlRegisterType("SortFilterProxyModel.Test", 0, 2, "StaticRole"); - qmlRegisterType("SortFilterProxyModel.Test", 0, 2, "SourceIndexRole"); - qmlRegisterType("SortFilterProxyModel.Test", 0, 2, "MultiRole"); -} - -Q_COREAPP_STARTUP_FUNCTION(registerTestRolesTypes) diff --git a/client/3rd/SortFilterProxyModel/tests/testroles.h b/client/3rd/SortFilterProxyModel/tests/testroles.h deleted file mode 100644 index 4fec59a1..00000000 --- a/client/3rd/SortFilterProxyModel/tests/testroles.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef TESTROLES_H -#define TESTROLES_H - -#include "proxyroles/singlerole.h" -#include - -class StaticRole : public qqsfpm::SingleRole -{ - Q_OBJECT - Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) -public: - using qqsfpm::SingleRole::SingleRole; - - QVariant value() const; - void setValue(const QVariant& value); - -Q_SIGNALS: - void valueChanged(); - -protected: - -private: - QVariant data(const QModelIndex& sourceIndex, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) override; - QVariant m_value; -}; - -class SourceIndexRole : public qqsfpm::SingleRole -{ -public: - using qqsfpm::SingleRole::SingleRole; - -private: - QVariant data(const QModelIndex& sourceIndex, const qqsfpm::QQmlSortFilterProxyModel& proxyModel) override; -}; - -class MultiRole : public qqsfpm::ProxyRole -{ -public: - using qqsfpm::ProxyRole::ProxyRole; - - QStringList names() override; - -private: - QVariant data(const QModelIndex &sourceIndex, const qqsfpm::QQmlSortFilterProxyModel &proxyModel, const QString &name) override; -}; - -#endif // TESTROLES_H diff --git a/client/3rd/SortFilterProxyModel/tests/tst_builtins.qml b/client/3rd/SortFilterProxyModel/tests/tst_builtins.qml deleted file mode 100644 index 855e33f3..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_builtins.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 - -Item { - ListModel { - id: testModel - ListElement{role1: 1; role2: 1} - ListElement{role1: 2; role2: 1} - ListElement{role1: 3; role2: 2} - ListElement{role1: 4; role2: 2} - } - ListModel { - id: noRolesFirstTestModel - function initModel() { - noRolesFirstTestModel.append({role1: 1, role2: 1 }) - noRolesFirstTestModel.append({role1: 2, role2: 1 }) - noRolesFirstTestModel.append({role1: 3, role2: 2 }) - noRolesFirstTestModel.append({role1: 4, role2: 2 }) - } - } - SortFilterProxyModel { - id: testProxyModel - property string tag: "testProxyModel" - sourceModel: testModel - filterRoleName: "role2" - filterValue: 2 - property var expectedData: ([{role1: 3, role2: 2}, {role1: 4, role2: 2}]) - } - SortFilterProxyModel { - id: noRolesFirstTestProxyModel - property string tag: "noRolesFirstTestProxyModel" - sourceModel: noRolesFirstTestModel - filterRoleName: "role2" - filterValue: 2 - property var expectedData: ([{role1: 3, role2: 2}, {role1: 4, role2: 2}]) - } - TestCase { - name: "BuiltinsFilterTests" - function test_filterValue_data() { - return [testProxyModel, noRolesFirstTestProxyModel]; - } - - function test_filterValue(proxyModel) { - if (proxyModel.sourceModel.initModel) - proxyModel.sourceModel.initModel() - var data = []; - for (var i = 0; i < proxyModel.count; i++) - data.push(proxyModel.get(i)); - compare(data, proxyModel.expectedData); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_delayed.qml b/client/3rd/SortFilterProxyModel/tests/tst_delayed.qml deleted file mode 100644 index 0264ce7d..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_delayed.qml +++ /dev/null @@ -1,209 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import SortFilterProxyModel.Test 0.2 - -Item { - ListModel { - id: testModel1 - ListElement{ role1: 1 } - } - SortFilterProxyModel { - id: testFilterProxyModel - sourceModel: testModel1 - property int foo: 1 - filters: [ - ExpressionFilter { - id: expressionFilter - property var w: ({count : 0}) // wrap count in a js object so modifying it doesn't bind it in the expression - expression: { - ++w.count; - testFilterProxyModel.foo; - return true; - } - }, - ValueFilter { - roleName: "role1" - value: testFilterProxyModel.foo - }, - ValueFilter { - roleName: "role1" - value: testFilterProxyModel.foo - } - ] - sorters: RoleSorter { - roleName: "role1" - sortOrder: testFilterProxyModel.foo === 1 ? Qt.AscendingOrder : Qt.DescendingOrder - } - } - - ListModel { - id: testModel2 - ListElement{ role1: 1 } - ListElement{ role1: 2 } - } - SortFilterProxyModel { - id: testSorterProxyModel - sourceModel: testModel2 - property bool foo: true - sorters: [ - ExpressionSorter { - id: expressionSorter - property var w: ({count : 0}) // wrap count in a js object so modifying it doesn't bind it in the expression - expression: { - ++w.count; - testSorterProxyModel.foo; - return false; - } - }, - RoleSorter { - roleName: "role1" - sortOrder: testSorterProxyModel.foo ? Qt.AscendingOrder : Qt.DescendingOrder - }, - RoleSorter { - roleName: "role1" - sortOrder: testSorterProxyModel.foo ? Qt.AscendingOrder : Qt.DescendingOrder - } - ] - } - - SortFilterProxyModel { - id: testRolesProxyModel - sourceModel: testModel1 - property bool foo: true - proxyRoles: [ - StaticRole { - name: "display" - value: 5 - }, - ExpressionRole { - id: expressionRole - name: "expressionRole" - property var w: ({count : 0}) // wrap count in a js object so modifying it doesn't bind it in the expression - expression: { - ++w.count; - return testRolesProxyModel.foo; - } - }, - StaticRole { - name: "role1" - value: testRolesProxyModel.foo - }, - StaticRole { - name: "role2" - value: testRolesProxyModel.foo - } - ] - } - - SignalSpy { - id: dataChangedSpy - target: testRolesProxyModel - signalName: "dataChanged" - } - - Instantiator { - id: instantiator - model: testRolesProxyModel - delegate: QtObject { property bool foo: model.expressionRole; property bool foo2: model.expressionRole } - } - - TestCase { - name: "DelayedTest" - - function test_directFilters() { - testFilterProxyModel.delayed = false; - expressionFilter.w.count = 0; - testFilterProxyModel.foo = 2; - compare(testFilterProxyModel.count, 0); - verify(expressionFilter.w.count > 1); - var lastEvaluationCount = expressionFilter.w.count; - wait(0); - compare(testFilterProxyModel.count, 0); - compare(expressionFilter.w.count, lastEvaluationCount); - } - - function test_delayedFilters() { - testFilterProxyModel.delayed = false; - testFilterProxyModel.foo = 2; - compare(testFilterProxyModel.count, 0); - testFilterProxyModel.delayed = true; - expressionFilter.w.count = 0; - testFilterProxyModel.foo = 0; - testFilterProxyModel.foo = 1; - compare(testFilterProxyModel.count, 0); - compare(expressionFilter.w.count, 0); - wait(0); - compare(testFilterProxyModel.count, 1); - compare(expressionFilter.w.count, 1); - } - - function test_directSorters() { - testSorterProxyModel.delayed = false; - testSorterProxyModel.foo = true; - compare(testSorterProxyModel.get(0).role1, 1); - expressionSorter.w.count = 0; - testSorterProxyModel.foo = false; - compare(testSorterProxyModel.get(0).role1, 2); - verify(expressionSorter.w.count > 1); - var lastEvaluationCount = expressionSorter.w.count - wait(0); - compare(testSorterProxyModel.get(0).role1, 2); - compare(expressionSorter.w.count, lastEvaluationCount); - } - - function test_delayedSorters() { - testSorterProxyModel.delayed = false; - testSorterProxyModel.foo = true; - compare(testSorterProxyModel.get(0).role1, 1); - testSorterProxyModel.delayed = true; - expressionSorter.w.count = 0; - testSorterProxyModel.foo = false; - testSorterProxyModel.foo = true; - testSorterProxyModel.foo = false; - compare(testSorterProxyModel.get(0).role1, 1); - compare(expressionSorter.w.count, 0); - wait(0); - compare(testSorterProxyModel.get(0).role1, 2); - compare(expressionSorter.w.count, 2); - } - - function test_proxyRoles() { - // init not delayed - testRolesProxyModel.delayed = false; - testRolesProxyModel.foo = true; - compare(instantiator.object.foo, true); - expressionRole.w.count = 0; - dataChangedSpy.clear(); - - // test not delayed - testRolesProxyModel.foo = false; - compare(instantiator.object.foo, false); - compare(dataChangedSpy.count, 3); - var notDelayedCount = expressionRole.w.count; // why is it 12 and not just 3 ? - wait(0); - compare(instantiator.object.foo, false); - compare(dataChangedSpy.count, 3); - compare(expressionRole.w.count, notDelayedCount); - - // init delayed - testRolesProxyModel.delayed = true; - expressionRole.w.count = 0; - dataChangedSpy.clear(); - - // test delayed - testRolesProxyModel.foo = true; - testRolesProxyModel.foo = false; - testRolesProxyModel.foo = true; - compare(instantiator.object.foo, false); - compare(dataChangedSpy.count, 0); - compare(expressionRole.w.count, 0); - wait(0); - compare(instantiator.object.foo, true); - compare(dataChangedSpy.count, 1); - var expectedDelayedCount = notDelayedCount / 3; - compare(expressionRole.w.count, expectedDelayedCount); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_expressionrole.qml b/client/3rd/SortFilterProxyModel/tests/tst_expressionrole.qml deleted file mode 100644 index 8bc0856f..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_expressionrole.qml +++ /dev/null @@ -1,43 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - property int c: 0 - ListModel { - id: listModel - ListElement { a: 1; b: 2 } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - proxyRoles: ExpressionRole { - name: "expressionRole" - expression: a + model.b + c - } - } - - Instantiator { - id: instantiator - model: testModel - QtObject { - property string expressionRole: model.expressionRole - } - } - - TestCase { - name: "ExpressionRole" - - function test_expressionRole() { - fuzzyCompare(instantiator.object.expressionRole, 3, 1e-7); - listModel.setProperty(0, "b", 9); - fuzzyCompare(instantiator.object.expressionRole, 10, 1e-7); - c = 1327; - fuzzyCompare(instantiator.object.expressionRole, 1337, 1e-7); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_filtercontainerattached.qml b/client/3rd/SortFilterProxyModel/tests/tst_filtercontainerattached.qml deleted file mode 100644 index 03ac0fad..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_filtercontainerattached.qml +++ /dev/null @@ -1,57 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtQml 2.2 -import QtTest 1.1 - -Item { - - ListModel { - id: dataModel - ListElement { a: 0; b: 0; c: 0 } - ListElement { a: 0; b: 0; c: 1 } - ListElement { a: 0; b: 1; c: 0 } - ListElement { a: 0; b: 1; c: 1 } - ListElement { a: 1; b: 0; c: 0 } - ListElement { a: 1; b: 0; c: 1 } - ListElement { a: 1; b: 1; c: 0 } - ListElement { a: 1; b: 1; c: 1 } - } - - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - - Instantiator { - id: filterInstantiator - model: ["a", "b", "c"] - delegate: ValueFilter { - FilterContainer.container: testModel - roleName: modelData - value: 1 - } - } - - TestCase { - name: "FilterContainerAttached" - - function modelValues() { - var modelValues = []; - - for (var i = 0; i < testModel.count; i++) - modelValues.push(testModel.get(i)); - - return modelValues; - } - - function test_filterContainers() { - compare(filterInstantiator.count, 3); - compare(modelValues(), [ { a: 1, b: 1, c: 1 }]); - filterInstantiator.model = ["a", "b"]; - wait(0); - compare(filterInstantiator.count, 2) - compare(modelValues(), [ { a: 1, b: 1, c: 0 }, { a: 1, b: 1, c: 1 }]); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_filtercontainers.qml b/client/3rd/SortFilterProxyModel/tests/tst_filtercontainers.qml deleted file mode 100644 index baff55f3..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_filtercontainers.qml +++ /dev/null @@ -1,103 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtTest 1.1 - -Item { - property list filters: [ - AllOf { - property string tag: "allOf" - property var expectedValues: [{a: 0, b: false}] - ValueFilter { - roleName: "a" - value: "0" - } - ValueFilter { - roleName: "b" - value: false - } - }, - AllOf { - property string tag: "allOfOneDisabled" - property var expectedValues: [{a: 0, b: true}, {a: 0, b: false}] - ValueFilter { - roleName: "a" - value: "0" - } - ValueFilter { - enabled: false - roleName: "b" - value: false - } - }, - AnyOf { - property string tag: "anyOf" - property var expectedValues: [{a: 0, b: true}, {a: 0, b: false}, {a: 1, b: false}] - ValueFilter { - roleName: "a" - value: "0" - } - ValueFilter { - roleName: "b" - value: false - } - } - ] - - AllOf { - id: outerFilter - ValueFilter { - roleName: "a" - value: "0" - } - ValueFilter { - id: innerFilter - roleName: "b" - value: false - } - } - - ListModel { - id: dataModel - ListElement { a: 0; b: true } - ListElement { a: 0; b: false } - ListElement { a: 1; b: true } - ListElement { a: 1; b: false } - } - - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - - TestCase { - name:"RangeFilterTests" - - function modelValues() { - var modelValues = []; - - for (var i = 0; i < testModel.count; i++) - modelValues.push(testModel.get(i)); - - return modelValues; - } - - function test_filterContainers_data() { - return filters; - } - - function test_filterContainers(filter) { - testModel.filters = filter; - compare(JSON.stringify(modelValues()), JSON.stringify(filter.expectedValues)); - } - - function test_changeInnerFilter() { - testModel.filters = outerFilter; - compare(JSON.stringify(modelValues()), JSON.stringify([{a: 0, b: false}])); - innerFilter.value = true; - compare(JSON.stringify(modelValues()), JSON.stringify([{a: 0, b: true}])); - innerFilter.enabled = false; - compare(JSON.stringify(modelValues()), JSON.stringify([{a: 0, b: true}, {a: 0, b: false}])); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_filterrole.qml b/client/3rd/SortFilterProxyModel/tests/tst_filterrole.qml deleted file mode 100644 index 38ba3947..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_filterrole.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { name: "1"; age: 18 } - ListElement { name: "2"; age: 22 } - ListElement { name: "3"; age: 45 } - ListElement { name: "4"; age: 10 } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - proxyRoles: FilterRole { - name: "isOldEnough" - RangeFilter { - id: ageFilter - roleName: "age" - minimumInclusive: true - minimumValue: 18 - } - } - } - TestCase { - name: "FilterRole" - - function test_filterRole() { - compare(testModel.get(0, "isOldEnough"), true); - compare(testModel.get(1, "isOldEnough"), true); - compare(testModel.get(2, "isOldEnough"), true); - compare(testModel.get(3, "isOldEnough"), false); - - ageFilter.minimumValue = 21; - - compare(testModel.get(0, "isOldEnough"), false); - compare(testModel.get(1, "isOldEnough"), true); - compare(testModel.get(2, "isOldEnough"), true); - compare(testModel.get(3, "isOldEnough"), false); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_filtersorter.qml b/client/3rd/SortFilterProxyModel/tests/tst_filtersorter.qml deleted file mode 100644 index 2b19691c..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_filtersorter.qml +++ /dev/null @@ -1,45 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { name: "1"; favorite: true } - ListElement { name: "2"; favorite: false } - ListElement { name: "3"; favorite: false } - ListElement { name: "4"; favorite: true } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - sorters: FilterSorter { - ValueFilter { - id: favoriteFilter - roleName: "favorite" - value: true - } - } - } - TestCase { - name: "FilterSorter" - - function test_filterSorter() { - compare(testModel.get(0, "name"), "1"); - compare(testModel.get(1, "name"), "4"); - compare(testModel.get(2, "name"), "2"); - compare(testModel.get(3, "name"), "3"); - - favoriteFilter.value = false; - - compare(testModel.get(0, "name"), "2"); - compare(testModel.get(1, "name"), "3"); - compare(testModel.get(2, "name"), "1"); - compare(testModel.get(3, "name"), "4"); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_helpers.qml b/client/3rd/SortFilterProxyModel/tests/tst_helpers.qml deleted file mode 100644 index 5610d3dc..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_helpers.qml +++ /dev/null @@ -1,111 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import SortFilterProxyModel.Test 0.2 - -Item { - ListModel { - id: dataModel - ListElement { - firstName: "Tupac" - lastName: "Shakur" - } - ListElement { - firstName: "Charles" - lastName: "Aznavour" - } - ListElement { - firstName: "Frank" - lastName: "Sinatra" - } - ListElement { - firstName: "Laurent" - lastName: "Garnier" - } - ListElement { - firstName: "Phillipe" - lastName: "Risoli" - } - } - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - SortFilterProxyModel { - id: testModel2 - sourceModel: dataModel - filters: ValueFilter { - inverted: true - roleName: "lastName" - value: "Sinatra" - } - sorters: [ - RoleSorter { roleName: "lastName"}, - RoleSorter { roleName: "firstName"} - ] - } - - TestCase { - name: "Helper functions" - - function test_getWithRoleName() { - compare(testModel.get(0, "lastName"), "Shakur"); - } - - function test_getWithoutRoleName() { - compare(testModel.get(1), { firstName: "Charles", lastName: "Aznavour"}); - } - - function test_roleForName() { - compare(testModel.data(testModel.index(0, 0), testModel.roleForName("firstName")), "Tupac"); - compare(testModel.data(testModel.index(1, 0), testModel.roleForName("lastName")), "Aznavour"); - } - - function test_mapToSource() { - compare(testModel2.mapToSource(3), 0); - compare(testModel2.mapToSource(4), -1); - } - - function test_mapToSourceLoop() { - for (var i = 0; i < testModel2.count; ++i) { - var sourceRow = testModel2.mapToSource(i); - compare(testModel2.get(i).lastName, dataModel.get(sourceRow).lastName); - } - } - - function test_mapToSourceLoop_index() { - for (var i = 0; i < testModel2.count; ++i) { - var proxyIndex = testModel2.index(i, 0); - var sourceIndex = testModel2.mapToSource(proxyIndex); - var roleNumber = testModel2.roleForName("lastName"); - compare(testModel2.data(proxyIndex, roleNumber), dataModel.data(sourceIndex, roleNumber)); - } - } - - function test_mapFromSource() { - compare(testModel2.mapFromSource(1), 0); - compare(testModel2.mapFromSource(2), -1); - } - - function test_mapFromSourceLoop() { - for (var i = 0; i < dataModel.count; ++i) { - var proxyRow = testModel2.mapFromSource(i); - if (proxyRow !== -1) { - compare(dataModel.get(i).lastName, testModel2.get(proxyRow).lastName); - } - } - } - - function test_mapFromSourceLoop_index() { - for (var i = 0; i < dataModel.count; ++i) { - var sourceIndex = dataModel.index(i, 0); - var proxyIndex = testModel2.mapFromSource(sourceIndex); - var roleNumber = testModel2.roleForName("lastName"); - if (proxyIndex.valid) - compare(testModel2.data(proxyIndex, roleNumber), dataModel.data(sourceIndex, roleNumber)); - } - } - - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_indexfilter.qml b/client/3rd/SortFilterProxyModel/tests/tst_indexfilter.qml deleted file mode 100644 index b275c59a..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_indexfilter.qml +++ /dev/null @@ -1,104 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtTest 1.1 - -Item { - property list filters: [ - IndexFilter { - property string tag: "basicUsage" - property var expectedValues: [3, 1, 2] - minimumIndex: 1; maximumIndex: 3 - }, - IndexFilter { - property string tag: "outOfBounds" - property var expectedValues: [] - minimumIndex: 3; maximumIndex: 1 - }, - IndexFilter { - property string tag: "0to0Inverted" - property var expectedValues: [3,1,2,4] - minimumIndex: 0; maximumIndex: 0; inverted: true - }, - IndexFilter { - property string tag: "0to0" // bug / issue #15 - property var expectedValues: [5] - minimumIndex: 0; maximumIndex: 0 - }, - IndexFilter { - property string tag: "basicUsageInverted" - property var expectedValues: [5,4] - minimumIndex: 1; maximumIndex: 3; inverted: true - }, - IndexFilter { - property string tag: "last" - property var expectedValues: [4] - minimumIndex: -1 - }, - IndexFilter { - property string tag: "fromEnd" - property var expectedValues: [2, 4] - minimumIndex: -2 - }, - IndexFilter { - property string tag: "fromEndRange" - property var expectedValues: [1, 2] - minimumIndex: -3 - maximumIndex: -2 - }, - IndexFilter { - property string tag: "mixedSignRange" - property var expectedValues: [3, 1, 2] - minimumIndex: 1 - maximumIndex: -2 - }, - IndexFilter { - property string tag: "toBigFilter" - property var expectedValues: [] - minimumIndex: 5 - }, - IndexFilter { - property string tag: "noFilter" - property var expectedValues: [5, 3, 1, 2, 4] - }, - IndexFilter { - property string tag: "undefinedFilter" - property var expectedValues: [5, 3, 1, 2, 4] - minimumIndex: undefined - maximumIndex: null - } - ] - - ListModel { - id: dataModel - ListElement { value: 5 } - ListElement { value: 3 } - ListElement { value: 1 } - ListElement { value: 2 } - ListElement { value: 4 } - } - - SortFilterProxyModel { - id: testModel - // FIXME: Crashes/fails with error if I define ListModel directly within sourceModel - sourceModel: dataModel - } - - TestCase { - name: "IndexFilterTests" - - function test_minMax_data() { - return filters; - } - - function test_minMax(filter) { - testModel.filters = filter; - - var actualValues = []; - for (var i = 0; i < testModel.count; i++) - actualValues.push(testModel.data(testModel.index(i, 0))); - - compare(actualValues, filter.expectedValues); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_joinrole.qml b/client/3rd/SortFilterProxyModel/tests/tst_joinrole.qml deleted file mode 100644 index c7a3bbe0..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_joinrole.qml +++ /dev/null @@ -1,45 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { firstName: "Justin"; lastName: "Timberlake" } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - proxyRoles: JoinRole { - id: joinRole - name: "fullName" - roleNames: ["firstName", "lastName"] - } - } - - Instantiator { - id: instantiator - model: testModel - QtObject { - property string fullName: model.fullName - } - } - - TestCase { - name: "JoinRole" - - function test_joinRole() { - compare(instantiator.object.fullName, "Justin Timberlake"); - listModel.setProperty(0, "lastName", "Bieber"); - compare(instantiator.object.fullName, "Justin Bieber"); - joinRole.roleNames = ["lastName", "firstName"]; - compare(instantiator.object.fullName, "Bieber Justin"); - joinRole.separator = " - "; - compare(instantiator.object.fullName, "Bieber - Justin"); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_proxyroles.qml b/client/3rd/SortFilterProxyModel/tests/tst_proxyroles.qml deleted file mode 100644 index c9746211..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_proxyroles.qml +++ /dev/null @@ -1,126 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import SortFilterProxyModel.Test 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { test: "first"; keep: true } - ListElement { test: "second"; keep: true } - ListElement { test: "third"; keep: true } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - filters: [ - ValueFilter { - roleName: "keep" - value: true - }, - ValueFilter { - inverted: true - roleName: "staticRole" - value: "filterMe" - } - ] - - proxyRoles: [ - StaticRole { - id: staticRole - name: "staticRole" - value: "foo" - }, - StaticRole { - id: renameRole - name: "renameMe" - value: "test" - }, - SourceIndexRole { - name: "sourceIndexRole" - }, - MultiRole {} - ] - } - - Instantiator { - id: instantiator - model: testModel - QtObject { - property string staticRole: model.staticRole - property int sourceIndexRole: model.sourceIndexRole - } - } - - ListModel { - id: singleRowModel - ListElement { - changingRole: "Change me" - otherRole: "I don't change" - } - } - - SortFilterProxyModel { - id: noProxyRolesProxyModel - sourceModel: singleRowModel - } - - Instantiator { - id: outerInstantiator - model: noProxyRolesProxyModel - QtObject { - property var counter: ({ count : 0 }) - property string changingRole: model.changingRole - property string otherRole: { - ++counter.count; - return model.otherRole; - } - } - } - - TestCase { - name: "ProxyRoles" - - function test_resetAfterNameChange() { - var oldObject = instantiator.object; - renameRole.name = "foobarRole"; - var newObject = instantiator.object; - verify(newObject !== oldObject, "Instantiator object should have been reinstantiated"); - } - - function test_proxyRoleInvalidation() { - compare(instantiator.object.staticRole, "foo"); - staticRole.value = "bar"; - compare(instantiator.object.staticRole, "bar"); - } - - function test_proxyRoleGetDataFromSource() { - compare(instantiator.object.sourceIndexRole, 0); - compare(testModel.get(1, "sourceIndexRole"), 1); - listModel.setProperty(1, "keep", false); - compare(testModel.get(1, "sourceIndexRole"), 2); - } - - function test_filterFromProxyRole() { - staticRole.value = "filterMe"; - compare(testModel.count, 0); - staticRole.value = "foo"; - compare(testModel.count, 3); - } - - function test_multiRole() { - compare(testModel.get(0, "role1"), "data for role1"); - compare(testModel.get(0, "role2"), "data for role2"); - } - - function test_ProxyRolesDataChanged() { - outerInstantiator.object.counter.count = 0; - singleRowModel.setProperty(0, "changingRole", "Changed") - compare(outerInstantiator.object.changingRole, "Changed"); - compare(outerInstantiator.object.counter.count, 0); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_rangefilter.qml b/client/3rd/SortFilterProxyModel/tests/tst_rangefilter.qml deleted file mode 100644 index d5dfe99e..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_rangefilter.qml +++ /dev/null @@ -1,99 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtTest 1.1 - -Item { - property list filters: [ - RangeFilter { - property string tag: "inclusive" - property int expectedModelCount: 3 - property var expectedValues: [3, 2, 4] - property QtObject dataModel: dataModel0 - roleName: "value"; minimumValue: 2; maximumValue: 4 - }, - RangeFilter { - property string tag: "explicitInclusive" - property int expectedModelCount: 3 - property var expectedValues: [3, 2, 4] - property QtObject dataModel: dataModel0 - roleName: "value"; minimumValue: 2; maximumValue: 4; minimumInclusive: true; maximumInclusive: true - }, - RangeFilter { - property string tag: "inclusiveMinExclusiveMax" - property int expectedModelCount: 2 - property var expectedValues: [2, 3] - property QtObject dataModel: dataModel1 - roleName: "value"; minimumValue: 2; maximumValue: 4; minimumInclusive: true; maximumInclusive: false - }, - RangeFilter { - property string tag: "exclusiveMinInclusiveMax" - property int expectedModelCount: 2 - property var expectedValues: [3, 4] - property QtObject dataModel: dataModel1 - roleName: "value"; minimumValue: 2; maximumValue: 4; minimumInclusive: false; maximumInclusive: true - }, - RangeFilter { - property string tag: "exclusive" - property int expectedModelCount: 1 - property var expectedValues: [3] - property QtObject dataModel: dataModel1 - roleName: "value"; minimumValue: 2; maximumValue: 4; minimumInclusive: false; maximumInclusive: false - }, - RangeFilter { - property string tag: "outOfBoundsRange" - property var expectedValues: [] - property QtObject dataModel: dataModel1 - roleName: "value"; minimumValue: 4; maximumValue: 2 - }, - RangeFilter { - objectName: tag - property string tag: "noMinimum" - property var expectedValues: [3, 1, 2] - property QtObject dataModel: dataModel0 - roleName: "value"; maximumValue: 3 - } - ] - - ListModel { - id: dataModel0 - ListElement { value: 5 } - ListElement { value: 3 } - ListElement { value: 1 } - ListElement { value: 2 } - ListElement { value: 4 } - } - - ListModel { - id: dataModel1 - ListElement { value: 5 } - ListElement { value: 2 } - ListElement { value: 3 } - ListElement { value: 1 } - ListElement { value: 4 } - } - - SortFilterProxyModel { id: testModel } - - TestCase { - name:"RangeFilterTests" - - function test_minMax_data() { - return filters; - } - - function test_minMax(filter) { - testModel.sourceModel = filter.dataModel; - testModel.filters = filter; - - verify(testModel.count === filter.expectedValues.length, - "Expected count " + filter.expectedValues.length + ", actual count: " + testModel.count); - for (var i = 0; i < testModel.count; i++) - { - var modelValue = testModel.get(i, filter.roleName); - verify(modelValue === filter.expectedValues[i], - "Expected testModel value " + filter.expectedValues[i] + ", actual: " + modelValue); - } - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_regexprole.qml b/client/3rd/SortFilterProxyModel/tests/tst_regexprole.qml deleted file mode 100644 index be4290b2..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_regexprole.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { dummyRole: false; compoundRole: "0 - zero"; unusedRole: "" } - ListElement { dummyRole: false; compoundRole: "1 - one"; unusedRole: "" } - ListElement { dummyRole: false; compoundRole: "2 - two"; unusedRole: "" } - ListElement { dummyRole: false; compoundRole: "3 - three"; unusedRole: "" } - ListElement { dummyRole: false; compoundRole: "four"; unusedRole: "" } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - proxyRoles: [ - RegExpRole { - id: regExpRole - roleName: "compoundRole" - pattern: "(?\\d+) - (?.+)" - }, - RegExpRole { - id: caseSensitiveRole - roleName: "compoundRole" - pattern: "\\d+ - (?[A-Z]+)" - caseSensitivity: Qt.CaseSensitive - }, - RegExpRole { - id: caseInsensitiveRole - roleName: "compoundRole" - pattern: "\\d+ - (?[A-Z]+)" - caseSensitivity: Qt.CaseInsensitive - } - ] - } - - TestCase { - name: "RegExpRole" - - function test_regExpRole() { - compare(testModel.get(0, "id"), "0"); - compare(testModel.get(1, "id"), "1"); - compare(testModel.get(0, "name"), "zero"); - compare(testModel.get(4, "id"), undefined); - compare(testModel.get(0, "nameCS"), undefined); - compare(testModel.get(0, "nameCIS"), "zero"); - } - } - } diff --git a/client/3rd/SortFilterProxyModel/tests/tst_rolesorter.qml b/client/3rd/SortFilterProxyModel/tests/tst_rolesorter.qml deleted file mode 100644 index 19bfde23..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_rolesorter.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtTest 1.1 - -Item { - property list sorters: [ - RoleSorter { - property string tag: "intRole" - property var expectedValues: [1, 2, 3, 4, 5] - roleName: "intRole" - }, - RoleSorter { - property string tag: "intRoleDescending" - property var expectedValues: [5, 4, 3, 2, 1] - roleName: "intRole" - sortOrder: Qt.DescendingOrder - }, - RoleSorter { - property string tag: "stringRole" - property var expectedValues: ["a", "b", "c", "d", "e"] - roleName: "stringRole" - }, - RoleSorter { - property string tag: "stringRoleDescending" - property var expectedValues: ["e", "d", "c", "b", "a"] - roleName: "stringRole" - sortOrder: Qt.DescendingOrder - }, - RoleSorter { - property string tag: "mixedCaseStringRole" - property var expectedValues: ["A", "b", "C", "D", "e"] - roleName: "mixedCaseStringRole" - } - ] - - ListModel { - id: dataModel - ListElement { intRole: 5; stringRole: "c"; mixedCaseStringRole: "C" } - ListElement { intRole: 3; stringRole: "e"; mixedCaseStringRole: "e" } - ListElement { intRole: 1; stringRole: "d"; mixedCaseStringRole: "D" } - ListElement { intRole: 2; stringRole: "a"; mixedCaseStringRole: "A" } - ListElement { intRole: 4; stringRole: "b"; mixedCaseStringRole: "b" } - } - - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - - TestCase { - name: "RoleSorterTests" - - function test_roleSorters_data() { - return sorters; - } - - function test_roleSorters(sorter) { - testModel.sorters = sorter; - - verify(testModel.count === sorter.expectedValues.length, - "Expected count " + sorter.expectedValues.length + ", actual count: " + testModel.count); - let actualValues = []; - for (var i = 0; i < testModel.count; i++) { - actualValues.push(testModel.get(i, sorter.roleName)); - } - compare(actualValues, sorter.expectedValues); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_sortercontainerattached.qml b/client/3rd/SortFilterProxyModel/tests/tst_sortercontainerattached.qml deleted file mode 100644 index a0d46d19..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_sortercontainerattached.qml +++ /dev/null @@ -1,131 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtQml 2.2 -import QtTest 1.1 - -Item { - - ListModel { - id: dataModel - ListElement { a: 3; b: 2; c: 9 } - ListElement { a: 3; b: 5; c: 0 } - ListElement { a: 3; b: 2; c: 8 } - ListElement { a: 2; b: 9; c: 1 } - ListElement { a: 2; b: 1; c: 7 } - ListElement { a: 2; b: 6; c: 2 } - ListElement { a: 1; b: 8; c: 6 } - ListElement { a: 1; b: 7; c: 3 } - ListElement { a: 1; b: 8; c: 5 } - } - - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - ListModel { - id: sorterRoleModel - ListElement { roleName: "a" } - ListElement { roleName: "b" } - ListElement { roleName: "c" } - } - Instantiator { - id: sorterInstantiator - model: sorterRoleModel - delegate: RoleSorter { - SorterContainer.container: testModel - roleName: model.roleName - } - } - - SortFilterProxyModel { - id: testModelPriority - sourceModel: dataModel - } - ListModel { - id: sorterRoleModelPriority - ListElement { roleName: "a" } - ListElement { roleName: "b" } - ListElement { roleName: "c" } - } - Instantiator { - id: sorterInstantiatorPriority - model: sorterRoleModelPriority - delegate: RoleSorter { - SorterContainer.container: testModelPriority - roleName: model.roleName - priority: -model.index - } - } - - TestCase { - name: "SorterContainerAttached" - - function modelValues(model) { - var modelValues = []; - - for (var i = 0; i < model.count; i++) - modelValues.push(model.get(i)); - - return modelValues; - } - - function test_sorterContainers() { - compare(sorterInstantiator.count, 3); - compare(modelValues(testModel), [ - { a: 1, b: 7, c: 3 }, - { a: 1, b: 8, c: 5 }, - { a: 1, b: 8, c: 6 }, - { a: 2, b: 1, c: 7 }, - { a: 2, b: 6, c: 2 }, - { a: 2, b: 9, c: 1 }, - { a: 3, b: 2, c: 8 }, - { a: 3, b: 2, c: 9 }, - { a: 3, b: 5, c: 0 } - ]); - sorterRoleModel.remove(0); // a, b, c --> b, c - wait(0); - compare(sorterInstantiator.count, 2); - compare(JSON.stringify(modelValues(testModel)), JSON.stringify([ - { a: 2, b: 1, c: 7 }, - { a: 3, b: 2, c: 8 }, - { a: 3, b: 2, c: 9 }, - { a: 3, b: 5, c: 0 }, - { a: 2, b: 6, c: 2 }, - { a: 1, b: 7, c: 3 }, - { a: 1, b: 8, c: 5 }, - { a: 1, b: 8, c: 6 }, - { a: 2, b: 9, c: 1 }, - ])); - } - - function test_sorterContainersPriority() { - compare(sorterInstantiatorPriority.count, 3); - compare(JSON.stringify(modelValues(testModelPriority)), JSON.stringify([ - { a: 1, b: 7, c: 3 }, - { a: 1, b: 8, c: 5 }, - { a: 1, b: 8, c: 6 }, - { a: 2, b: 1, c: 7 }, - { a: 2, b: 6, c: 2 }, - { a: 2, b: 9, c: 1 }, - { a: 3, b: 2, c: 8 }, - { a: 3, b: 2, c: 9 }, - { a: 3, b: 5, c: 0 } - ])); - sorterRoleModelPriority.move(0, 1, 1); // a, b, c --> b, a, c - wait(0); - compare(sorterInstantiatorPriority.count, 3); - compare(JSON.stringify(modelValues(testModelPriority)), JSON.stringify([ - { a: 2, b: 1, c: 7 }, - { a: 3, b: 2, c: 8 }, - { a: 3, b: 2, c: 9 }, - { a: 3, b: 5, c: 0 }, - { a: 2, b: 6, c: 2 }, - { a: 1, b: 7, c: 3 }, - { a: 1, b: 8, c: 5 }, - { a: 1, b: 8, c: 6 }, - { a: 2, b: 9, c: 1 } - ])); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_sorters.qml b/client/3rd/SortFilterProxyModel/tests/tst_sorters.qml deleted file mode 100644 index 23a21d9e..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_sorters.qml +++ /dev/null @@ -1,158 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import SortFilterProxyModel.Test 0.2 - -Item { - ListModel { - id: listModel - ListElement { test: "first"; test2: "c"; test3: 1 } - ListElement { test: "second"; test2: "a"; test3: 0 } - ListElement { test: "third"; test2: "b"; test3: 2} - ListElement { test: "fourth"; test2: "b"; test3: 3 } - } - - ListModel { - id: noRolesFirstListModel - } - - property list sorters: [ - QtObject { - property string tag: "no sorter" - property bool notASorter: true - property var expectedValues: ["first", "second", "third", "fourth"] - }, - IndexSorter { - property string tag: "Dummy IndexSorter" - property var expectedValues: ["first", "second", "third", "fourth"] - }, - ReverseIndexSorter { - property string tag: "Dummy ReverseIndexSorter" - property var expectedValues: ["fourth", "third", "second", "first"] - }, - IndexSorter { - property string tag: "Disabled dummy IndexSorter" - enabled: false - property var expectedValues: ["first", "second", "third", "fourth"] - }, - ReverseIndexSorter { - property string tag: "Disabled dummy ReverseIndexSorter" - enabled: false - property var expectedValues: ["first", "second", "third", "fourth"] - }, - IndexSorter { - property string tag: "Descending dummy IndexSorter" - ascendingOrder: false - property var expectedValues: ["fourth", "third", "second", "first"] - }, - ReverseIndexSorter { - property string tag: "Descending dummy ReverseIndexSorter" - ascendingOrder: false - property var expectedValues: ["first", "second", "third", "fourth"] - }, - IndexSorter { - property string tag: "Disabled descending dummy IndexSorter" - enabled: false - ascendingOrder: false - property var expectedValues: ["first", "second", "third", "fourth"] - }, - ReverseIndexSorter { - property string tag: "Disabled descending dummy ReverseIndexSorter" - enabled: false - ascendingOrder: false - property var expectedValues: ["first", "second", "third", "fourth"] - } - ] - - ReverseIndexSorter { - id: reverseIndexSorter - } - - property list tieSorters: [ - RoleSorter { roleName: "test2" }, - RoleSorter { roleName: "test" } - ] - - property list sortersWithPriority: [ - RoleSorter { roleName: "test3" }, - RoleSorter { roleName: "test" }, - RoleSorter { roleName: "test2"; priority: 1 } - ] - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - } - - SortFilterProxyModel { - id: noRolesFirstProxyModel - sourceModel: noRolesFirstListModel - sorters: RoleSorter { roleName: "test" } - } - - TestCase { - name: "SortersTests" - - function test_indexOrder_data() { - return sorters; - } - - function test_indexOrder(sorter) { - testModel.sorters = sorter; - verifyModelValues(testModel, sorter.expectedValues); - } - - function test_enablingSorter() { - reverseIndexSorter.enabled = false; - testModel.sorters = reverseIndexSorter; - var expectedValuesBeforeEnabling = ["first", "second", "third", "fourth"]; - var expectedValuesAfterEnabling = ["fourth", "third", "second", "first"]; - verifyModelValues(testModel, expectedValuesBeforeEnabling); - reverseIndexSorter.enabled = true; - verifyModelValues(testModel, expectedValuesAfterEnabling); - } - - function test_disablingSorter() { - reverseIndexSorter.enabled = true; - testModel.sorters = reverseIndexSorter; - var expectedValuesBeforeDisabling = ["fourth", "third", "second", "first"]; - var expectedValuesAfterDisabling = ["first", "second", "third", "fourth"]; - verifyModelValues(testModel, expectedValuesBeforeDisabling); - reverseIndexSorter.enabled = false; - verifyModelValues(testModel, expectedValuesAfterDisabling); - } - - function test_tieSorters() { - testModel.sorters = tieSorters; - var expectedValues = ["second", "fourth", "third", "first"]; - verifyModelValues(testModel, expectedValues); - } - - function test_sortersWithPriority() { - testModel.sorters = sortersWithPriority; - var expectedValues = ["second", "third", "fourth", "first"]; - verifyModelValues(testModel, expectedValues); - testModel.sorters[0].priority = 2; - expectedValues = ["second", "first", "third", "fourth"]; - verifyModelValues(testModel, expectedValues); - } - - function test_noRolesFirstModel() { - noRolesFirstListModel.append([{test: "b"}, {test: "a"}]); - var expectedValues = ["a", "b"]; - verifyModelValues(noRolesFirstProxyModel, expectedValues); - } - - function verifyModelValues(model, expectedValues) { - verify(model.count === expectedValues.length, - "Expected count " + expectedValues.length + ", actual count: " + model.count); - for (var i = 0; i < model.count; i++) - { - var modelValue = model.get(i, "test"); - verify(modelValue === expectedValues[i], - "Expected testModel value " + expectedValues[i] + ", actual: " + modelValue); - } - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_sortfilterproxymodel.cpp b/client/3rd/SortFilterProxyModel/tests/tst_sortfilterproxymodel.cpp deleted file mode 100644 index 90f5a6ba..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_sortfilterproxymodel.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include -QUICK_TEST_MAIN(SortFilterProxyModel) diff --git a/client/3rd/SortFilterProxyModel/tests/tst_sourceroles.qml b/client/3rd/SortFilterProxyModel/tests/tst_sourceroles.qml deleted file mode 100644 index ff747cc2..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_sourceroles.qml +++ /dev/null @@ -1,49 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.1 -import QtQml 2.2 -import SortFilterProxyModel 0.2 - -Item { - ListModel { - id: nonEmptyFirstModel - ListElement { - test: "test" - } - } - SortFilterProxyModel { - id: nonEmptyFirstProxyModel - sourceModel: nonEmptyFirstModel - } - Instantiator { - id: nonEmptyFirstInstantiator - model: nonEmptyFirstProxyModel - QtObject { property var test: model.test } - } - - ListModel { - id: emptyFirstModel - } - SortFilterProxyModel { - id: emptyFirstProxyModel - sourceModel: emptyFirstModel - } - Instantiator { - id: emptyFirstInstantiator - model: emptyFirstProxyModel - QtObject { property var test: model.test } - } - - TestCase { - name: "RoleTests" - - function test_nonEmptyFirst() { - compare(nonEmptyFirstInstantiator.object.test, "test"); - } - - function test_emptyFirst() { - emptyFirstModel.append({test: "test"}); - compare(emptyFirstProxyModel.get(0), {test: "test"}); - compare(emptyFirstInstantiator.object.test, "test"); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_stringsorter.qml b/client/3rd/SortFilterProxyModel/tests/tst_stringsorter.qml deleted file mode 100644 index 3e22c65b..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_stringsorter.qml +++ /dev/null @@ -1,85 +0,0 @@ -import QtQuick 2.0 -import SortFilterProxyModel 0.2 -import QtQml.Models 2.2 -import QtTest 1.1 - -Item { - property list sorters: [ - StringSorter { - property string tag: "normal" - property var expectedValues: ["haha", "hähä", "hehe", "héhé", "hihi", "huhu"] - roleName: "accentRole" - }, - StringSorter { - property string tag: "numericMode" - property var expectedValues: ["a1", "a20", "a30", "a99", "a100", "a1000"] - roleName: "numericRole" - numericMode: true - }, - StringSorter { - property string tag: "nonNumericMode" - property var expectedValues: ["a1", "a100", "a1000", "a20", "a30", "a99"] - roleName: "numericRole" - numericMode: false - }, - StringSorter { - property string tag: "caseSensitive" - property var expectedValues: ["a", "A", "b", "c", "z", "Z"] - roleName: "caseRole" - caseSensitivity: Qt.CaseSensitive - }, - StringSorter { - property string tag: "nonCaseSensitive" - property var expectedValues: ["A", "a", "b", "c", "Z", "z"] - roleName: "caseRole" - caseSensitivity: Qt.CaseInsensitive - }, - StringSorter { - property string tag: "ignorePunctuation" - property var expectedValues: ["a-a", "aa", "b-b", "b-c", "b.c", "bc"] - roleName: "punctuationRole" - ignorePunctation: true - }, - StringSorter { - property string tag: "doNotIgnorePunctuation" - property var expectedValues: ["aa", "a-a", "b.c", "b-b", "bc", "b-c"] - roleName: "punctuationRole" - ignorePunctation: false - } - ] - - ListModel { - id: dataModel - ListElement { accentRole: "héhé"; numericRole: "a20"; caseRole: "b"; punctuationRole: "a-a"} - ListElement { accentRole: "hehe"; numericRole: "a1"; caseRole: "A"; punctuationRole: "aa"} - ListElement { accentRole: "haha"; numericRole: "a100"; caseRole: "a"; punctuationRole: "b-c"} - ListElement { accentRole: "huhu"; numericRole: "a99"; caseRole: "c"; punctuationRole: "b.c"} - ListElement { accentRole: "hihi"; numericRole: "a30"; caseRole: "Z"; punctuationRole: "bc"} - ListElement { accentRole: "hähä"; numericRole: "a1000"; caseRole: "z"; punctuationRole: "b-b"} - } - - SortFilterProxyModel { - id: testModel - sourceModel: dataModel - } - - TestCase { - name: "StringSorterTests" - - function test_stringSorters_data() { - return sorters; - } - - function test_stringSorters(sorter) { - testModel.sorters = sorter; - - verify(testModel.count === sorter.expectedValues.length, - "Expected count " + sorter.expectedValues.length + ", actual count: " + testModel.count); - let actualValues = []; - for (var i = 0; i < testModel.count; i++) { - actualValues.push(testModel.get(i, sorter.roleName)); - } - compare(actualValues, sorter.expectedValues); - } - } -} diff --git a/client/3rd/SortFilterProxyModel/tests/tst_switchrole.qml b/client/3rd/SortFilterProxyModel/tests/tst_switchrole.qml deleted file mode 100644 index e8721f10..00000000 --- a/client/3rd/SortFilterProxyModel/tests/tst_switchrole.qml +++ /dev/null @@ -1,99 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.2 -import QtTest 1.1 -import SortFilterProxyModel 0.2 -import QtQml 2.2 - -Item { - ListModel { - id: listModel - ListElement { name: "1"; favorite: true } - ListElement { name: "2"; favorite: false } - ListElement { name: "3"; favorite: false } - ListElement { name: "4"; favorite: true } - } - - SortFilterProxyModel { - id: testModel - sourceModel: listModel - - proxyRoles: SwitchRole { - id: switchRole - name: "switchRole" - ValueFilter { - id: valueFilter - roleName: "favorite" - value: true - SwitchRole.value: "*" - } - ValueFilter { - id: secondValueFilter - roleName: "favorite" - value: true - SwitchRole.value: "%" - } - ValueFilter { - id: thirdValueFilter - roleName: "name" - value: 3 - SwitchRole.value: "three" - } - defaultRoleName: "name" - defaultValue: "foo" - } - } - - Instantiator { - id: instantiator - model: testModel - QtObject { - property var switchRole: model.switchRole - } - } - - TestCase { - name: "SwitchRole" - - function test_role() { - compare(testModel.get(0, "switchRole"), "*"); - compare(testModel.get(1, "switchRole"), "2"); - compare(testModel.get(2, "switchRole"), "three"); - compare(testModel.get(3, "switchRole"), "*"); - } - - function test_valueChange() { - compare(instantiator.object.switchRole, "*"); - valueFilter.SwitchRole.value = "test"; - compare(instantiator.object.switchRole, "test"); - valueFilter.SwitchRole.value = "*"; - } - - function test_filterChange() { - compare(instantiator.object.switchRole, "*"); - valueFilter.enabled = false; - compare(instantiator.object.switchRole, "%"); - valueFilter.enabled = true; - } - - function test_defaultSourceChange() { - compare(instantiator.object.switchRole, "*"); - listModel.setProperty(0, "favorite", false); - compare(instantiator.object.switchRole, "1"); - compare(instantiator.objectAt(1).switchRole, "2"); - listModel.setProperty(1, "name", "test"); - compare(instantiator.objectAt(1).switchRole, "test"); - - listModel.setProperty(1, "name", "2"); - listModel.setProperty(0, "favorite", true); - } - - function test_defaultValue() { - switchRole.defaultRoleName = ""; - compare(instantiator.objectAt(1).switchRole, "foo"); - switchRole.defaultValue = "bar"; - compare(instantiator.objectAt(1).switchRole, "bar"); - switchRole.defaultRoleName = "name"; - switchRole.defaultValue = "foo"; - } - } -} diff --git a/client/3rd/SortFilterProxyModel/utils/utils.cpp b/client/3rd/SortFilterProxyModel/utils/utils.cpp deleted file mode 100644 index e32f5094..00000000 --- a/client/3rd/SortFilterProxyModel/utils/utils.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "utils.h" - -#include - -namespace qqsfpm { - -int compareVariants(const QVariant &lhs, const QVariant &rhs) -{ - // Do the QString check first because otherwise the canConvert check will get hit for strings. - if (lhs.typeId() == QMetaType::QString && rhs.typeId() == QMetaType::QString) { - const auto lhsValue = lhs.toString(); - const auto rhsValue = rhs.toString(); - if (lhsValue == rhsValue) - return 0; - return lhsValue.compare(rhsValue, Qt::CaseInsensitive); - } else if (lhs.typeId() == QMetaType::Bool && rhs.typeId() == QMetaType::Bool) { - const auto lhsValue = lhs.toBool(); - const auto rhsValue = rhs.toBool(); - if (lhsValue == rhsValue) - return 0; - // false < true. - return !lhsValue ? -1 : 1; - } else if (lhs.typeId() == QMetaType::QDate && rhs.typeId() == QMetaType::QDate) { - const auto lhsValue = lhs.toDate(); - const auto rhsValue = rhs.toDate(); - if (lhsValue == rhsValue) - return 0; - return lhsValue < rhsValue ? -1 : 1; - } else if (lhs.typeId() == QMetaType::QDateTime && rhs.typeId() == QMetaType::QDateTime) { - const auto lhsValue = lhs.toDateTime(); - const auto rhsValue = rhs.toDateTime(); - if (lhsValue == rhsValue) - return 0; - return lhsValue < rhsValue ? -1 : 1; - } else if (lhs.typeId() == QMetaType::QStringList && rhs.typeId() == QMetaType::QStringList) { - const auto lhsValue = lhs.toStringList(); - const auto rhsValue = rhs.toStringList(); - if (lhsValue == rhsValue) - return 0; - return lhsValue < rhsValue ? -1 : 1; - } else if (lhs.canConvert() && rhs.canConvert()) { - const auto lhsValue = lhs.toInt(); - const auto rhsValue = rhs.toInt(); - if (lhsValue == rhsValue) - return 0; - return lhsValue < rhsValue ? -1 : 1; - } else if (lhs.canConvert() && rhs.canConvert()) { - const auto lhsValue = lhs.toReal(); - const auto rhsValue = rhs.toReal(); - if (qFuzzyCompare(lhsValue, rhsValue)) - return 0; - return lhsValue < rhsValue ? -1 : 1; - } - - qWarning() << "Don't know how to compare" << lhs << "against" << rhs << "- returning 0"; - return 0; -} - -} diff --git a/client/3rd/SortFilterProxyModel/utils/utils.h b/client/3rd/SortFilterProxyModel/utils/utils.h deleted file mode 100644 index 199c57be..00000000 --- a/client/3rd/SortFilterProxyModel/utils/utils.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H - -#include - -namespace qqsfpm { - -int compareVariants(const QVariant &lhs, const QVariant &rhs); - -inline bool operator<(const QVariant &lhs, const QVariant &rhs) { return compareVariants(lhs, rhs) < 0; } -inline bool operator<=(const QVariant &lhs, const QVariant &rhs) { return compareVariants(lhs, rhs) <= 0; } -inline bool operator>(const QVariant &lhs, const QVariant &rhs) { return compareVariants(lhs, rhs) > 0; } -inline bool operator>=(const QVariant &lhs, const QVariant &rhs) { return compareVariants(lhs, rhs) >= 0; } - -} - -#endif // UTILS_H diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index 4031cea7..1ea2900c 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -169,7 +169,7 @@ void AmneziaApplication::registerTypes() void AmneziaApplication::loadFonts() { - QQuickStyle::setStyle("Basic"); + QQuickStyle::setStyle("Basic"); QFontDatabase::addApplicationFont(":/fonts/Lato-Black.ttf"); QFontDatabase::addApplicationFont(":/fonts/Lato-BlackItalic.ttf"); diff --git a/client/ui/pages_logic/GeneralSettingsLogic.cpp b/client/ui/pages_logic/GeneralSettingsLogic.cpp index dc6375cc..c4b04c01 100644 --- a/client/ui/pages_logic/GeneralSettingsLogic.cpp +++ b/client/ui/pages_logic/GeneralSettingsLogic.cpp @@ -13,7 +13,7 @@ GeneralSettingsLogic::GeneralSettingsLogic(UiLogic *logic, QObject *parent): void GeneralSettingsLogic::onUpdatePage() { uiLogic()->selectedServerIndex = m_settings->defaultServerIndex(); - set_existsAnyServer(uiLogic()->selectedServerIndex >= 0); + set_existsAnyServer(uiLogic()->selectedServerIndex >= 0); uiLogic()->selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex()); set_pushButtonGeneralSettingsShareConnectionEnable(m_settings->haveAuthData(m_settings->defaultServerIndex())); diff --git a/client/ui/pages_logic/GeneralSettingsLogic.h b/client/ui/pages_logic/GeneralSettingsLogic.h index ddaf755f..a0cff333 100644 --- a/client/ui/pages_logic/GeneralSettingsLogic.h +++ b/client/ui/pages_logic/GeneralSettingsLogic.h @@ -10,7 +10,7 @@ class GeneralSettingsLogic : public PageLogicBase Q_OBJECT AUTO_PROPERTY(bool, pushButtonGeneralSettingsShareConnectionEnable) - AUTO_PROPERTY(bool, existsAnyServer) + AUTO_PROPERTY(bool, existsAnyServer) public: Q_INVOKABLE void onUpdatePage() override; diff --git a/client/ui/pages_logic/ShareConnectionLogic.cpp b/client/ui/pages_logic/ShareConnectionLogic.cpp index 98f928c0..85849391 100644 --- a/client/ui/pages_logic/ShareConnectionLogic.cpp +++ b/client/ui/pages_logic/ShareConnectionLogic.cpp @@ -3,7 +3,6 @@ #include #include - #include "qrcodegen.hpp" #include "ShareConnectionLogic.h" From 833364a94ee160e205d6d730db198385af7d9307 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 18 Dec 2022 18:11:41 +0300 Subject: [PATCH 2/5] added SortFilterProxyModel submodule --- .gitmodules | 3 +++ client/3rd/SortFilterProxyModel | 1 + 2 files changed, 4 insertions(+) create mode 160000 client/3rd/SortFilterProxyModel diff --git a/.gitmodules b/.gitmodules index a8295ac7..3447966d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "client/3rd/qtkeychain"] path = client/3rd/qtkeychain url = https://github.com/frankosterfeld/qtkeychain.git +[submodule "client/3rd/SortFilterProxyModel"] + path = client/3rd/SortFilterProxyModel + url = https://github.com/mitchcurtis/SortFilterProxyModel.git diff --git a/client/3rd/SortFilterProxyModel b/client/3rd/SortFilterProxyModel new file mode 160000 index 00000000..f2881493 --- /dev/null +++ b/client/3rd/SortFilterProxyModel @@ -0,0 +1 @@ +Subproject commit f2881493e42bd7b7d5b7abe804dad084dd610b71 From 1fd1b0388b9dfd0d8431529f3514391b93413c86 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 18 Dec 2022 18:27:08 +0300 Subject: [PATCH 3/5] removed unused code --- client/protocols/android_vpnprotocol.cpp | 8 +------- client/ui/qml/Controls/SettingButtonType.qml | 1 - client/ui/qml/Controls/ShareConnectionContent.qml | 1 - service/src/qtservice.h | 1 - 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/client/protocols/android_vpnprotocol.cpp b/client/protocols/android_vpnprotocol.cpp index cf9e443a..d86a3342 100644 --- a/client/protocols/android_vpnprotocol.cpp +++ b/client/protocols/android_vpnprotocol.cpp @@ -1,9 +1,3 @@ -//#include -//#include -//#include -//#include -//#include -//#include #include #include #include @@ -12,7 +6,7 @@ #include #include #include -//#include + #include diff --git a/client/ui/qml/Controls/SettingButtonType.qml b/client/ui/qml/Controls/SettingButtonType.qml index b2596549..6166793d 100644 --- a/client/ui/qml/Controls/SettingButtonType.qml +++ b/client/ui/qml/Controls/SettingButtonType.qml @@ -8,7 +8,6 @@ BasicButtonType { background: Item {} contentItem: Item { -// anchors.fill: parent SvgImageType { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter diff --git a/client/ui/qml/Controls/ShareConnectionContent.qml b/client/ui/qml/Controls/ShareConnectionContent.qml index 09c3bfe2..99427aef 100644 --- a/client/ui/qml/Controls/ShareConnectionContent.qml +++ b/client/ui/qml/Controls/ShareConnectionContent.qml @@ -1,6 +1,5 @@ import QtQuick import QtQuick.Controls -//import QtGraphicalEffects 1.12 import QtQuick.Shapes 1.4 Item { diff --git a/service/src/qtservice.h b/service/src/qtservice.h index 4fb3c3c4..bea140b4 100644 --- a/service/src/qtservice.h +++ b/service/src/qtservice.h @@ -59,7 +59,6 @@ # define QT_QTSERVICE_EXPORT #endif -//class QStringList; class QtServiceControllerPrivate; class QT_QTSERVICE_EXPORT QtServiceController From 93c43ecbc32b5abd014bdc723e0c483870622e75 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 27 Nov 2022 01:35:13 +0300 Subject: [PATCH 4/5] removed unused qzxing folder --- client/3rd/qzxing | 1 - 1 file changed, 1 deletion(-) delete mode 160000 client/3rd/qzxing diff --git a/client/3rd/qzxing b/client/3rd/qzxing deleted file mode 160000 index 2fd4dd60..00000000 --- a/client/3rd/qzxing +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2fd4dd60c04a29c6d1271fdd9ae25378b8f61ec8 From f9f197afd02abbf22efd0dab5eca39ea1152b921 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 18 Dec 2022 19:36:19 +0300 Subject: [PATCH 5/5] removed unused code --- client/platforms/android/android_controller.cpp | 8 -------- client/platforms/android/android_controller.h | 2 -- client/ui/pages_logic/StartPageLogic.cpp | 4 ---- 3 files changed, 14 deletions(-) diff --git a/client/platforms/android/android_controller.cpp b/client/platforms/android/android_controller.cpp index 36ed9397..12589664 100644 --- a/client/platforms/android/android_controller.cpp +++ b/client/platforms/android/android_controller.cpp @@ -1,9 +1,3 @@ -//#include -//#include -//#include -//#include -//#include -//#include #include #include #include @@ -12,11 +6,9 @@ #include #include #include -//#include #include - #include "android_controller.h" #include "core/errorstrings.h" #include "ui/pages_logic/StartPageLogic.h" diff --git a/client/platforms/android/android_controller.h b/client/platforms/android/android_controller.h index cbe36a31..b2543d5d 100644 --- a/client/platforms/android/android_controller.h +++ b/client/platforms/android/android_controller.h @@ -1,8 +1,6 @@ #ifndef ANDROID_CONTROLLER_H #define ANDROID_CONTROLLER_H -//#include -//#include #include #include "ui/uilogic.h" diff --git a/client/ui/pages_logic/StartPageLogic.cpp b/client/ui/pages_logic/StartPageLogic.cpp index 8c24b0d8..e899c514 100644 --- a/client/ui/pages_logic/StartPageLogic.cpp +++ b/client/ui/pages_logic/StartPageLogic.cpp @@ -184,10 +184,6 @@ bool StartPageLogic::importConnectionFromCode(QString code) return importConnection(o); } - o = QJsonDocument::fromJson(ba).object(); - if (!o.isEmpty()) { - return importConnection(o); - } return false; }