Commit Graph

133 Commits

Author SHA1 Message Date
Alex Jbanca b176badf6e fix: Revert commit - Improve sorting performance
The proper fix will be handled in another task
2024-02-06 10:10:58 +02:00
Alex Jbanca 67a7f727a6
Merge pull request #3 from status-im/pert/improveSortingPerformance
perf(SortFilterProxyModel): Improve sorting performance
2024-01-31 20:44:49 +02:00
Alex Jbanca dae1dcaa13
perf(SortFilterProxyModel): Improve sorting performance
Implement strict less in lessThan override. This function is used as the < operator when sorting.

+ avoid row invalidation if the model component is not ready
+ `Sorter::invalidate` is virtual. It provides more control to the derived classes
2024-01-31 20:42:50 +02:00
Lukáš Tinkl 70b76297fd clazy fixes
- don't detach containers while iterating
- mixing const/non-const iterators
- const/qAsConst fixes
- QStringLiteral usage
- nullptr fixes
- don't #include whole Qt modules in .h files
2023-07-19 10:50:21 +02:00
Lukáš Tinkl 497171b3dd Revert "feat: limit the number of results"
This reverts commit 285a86d492.
2023-07-19 10:50:21 +02:00
Lukáš Tinkl 285a86d492 feat: limit the number of results
introduce a new property, `limit` that allows for narrowing down the
number of returned results

usecase: give me list of 5 most valuable assets

```qml
tagsModel: SortFilterProxyModel {
    id: walletAccountAssetsModel
    sourceModel: assets
    limit: 5
    function filterPredicate(modelData) {
        return d.uniquePermissionTokenKeys.includes(modelData.symbol.toUpperCase())
    }
    filters: [
        ExpressionFilter {
            expression: walletAccountAssetsModel.filterPredicate(model)
        }
    ]
    sorters: ExpressionSorter {
        expression: {
            return modelLeft.enabledNetworkBalance.amount > modelRight.enabledNetworkBalance.amount // descending, biggest first
        }
    }
}
```
2023-07-13 15:35:18 +02:00
Lukáš Tinkl c32b851264 chore: clazy fixes
- detaching container while iterating
- mixing const and non-const iterators
2023-07-13 15:35:18 +02:00
Patryk Osmaczko 6a471f1bef chore: add qqsfpm::registerTypes()
Under some circumstances, auto-registration doesn't work,
call this function to ensure types are registered.
2022-07-19 17:00:52 +02:00
Patryk Osmaczko 63e64c0a93 chore: use target_compile_features for setting lang standard 2022-07-19 16:53:50 +02:00
Mitch Curtis 5a930885b7
Add SortFilterProxyModel.qbs for inclusion into Qbs projects (#89)
This can be used similary to how the .pri is used. For example,
to build it as part of an existing library:

import "../3rdparty/SortFilterProxyModel/SortFilterProxyModel.qbs" as SortFilterProxyModelSources

    Product {
        // ...

        cpp.includePaths: [
            sortFilterProxyModelSources.prefix
        ]

        SortFilterProxyModelSources {
            id: sortFilterProxyModelSources
        }
    }
2021-05-03 22:51:37 +02:00
grecko 6678acc67c doc: improve and regenerate doc 2020-02-02 16:27:46 +01:00
grecko 53c01b6ee3 feat: Add Sorter.priority property 2020-02-02 13:39:47 +01:00
grecko 314598ae54 feat: Add FilterContainer and SorterContainer attached types
feat: Add FilterContainer and SorterContainer attached types
2020-02-02 13:39:47 +01:00
Pierre-Yves Siret 7921c92f5a test: make delayed test independent of Qt version
The number of time the QQmlExpression was evaluated changed between 5.13
and 5.14
2020-01-08 23:46:12 +01:00
Pierre-Yves Siret 47ac3de0c1 doc: fix delayed property documentation 2020-01-08 23:15:19 +01:00
oKcerG 35ffc48d7f
Revert "Support Qt in namespace (#69)" (#71)
This reverts commit f8393999b6.
2020-01-07 00:30:45 +01:00
Pierre-Yves Siret 1e98ca7776 Revert "Support Qt in namespace (#69)"
The commit broke the build for non namespaced Qt
This reverts commit f8393999b6.

closes #70
2020-01-07 00:22:18 +01:00
Patrick Stewart f8393999b6 Support Qt in namespace (#69)
Enable support for Qt built with the -qtnamespace configure option
2019-12-20 15:40:28 +01:00
grecko 36befddf5d feat: Add delayed property 2019-07-25 00:18:37 +02:00
grecko 770789ee48 fix: Fix dataChanged bug
dataChanged was emitted for all roles when dataChanged was emitted for a single role and we had no proxy role.

Fixes #60
2019-05-06 02:23:03 +02:00
grecko 26501aa078 test: reproduce dataChanged bug
#60
2019-05-06 02:18:07 +02:00
grecko 4d96016151 test: Add a missing test for proxy roles 2019-05-06 02:15:56 +02:00
Grecko ae14fc994f fix: Fix RangeFilter bug
Closes #58
2018-10-30 01:17:30 +01:00
Grecko 7345ddfb89 test: reproduct RangeFilter bug
This test demonstrates the bug mentionned in issue #58
2018-10-30 00:49:53 +01:00
Jeroen Oomkes 02f8f9ef65 Cmake support (#55)
* Added cmake support. This builds an object library target that can be included with generator expression in the executable.
2018-10-20 00:27:31 +02:00
Alberto Mardegan a4b7b6e1d1 proxyroles: Fix warning on unused parameter 2018-10-11 22:27:09 +02:00
Grecko f77d371786 doc: regenerate doc 2018-10-01 21:24:50 +02:00
Grecko 8d6f679f49 doc: fix FilterRole and RegExpRole doc 2018-10-01 21:24:24 +02:00
Grecko fd147bbb57 doc: Add doc for RegExpRole
small changes to SwitchRole and RegExpFilter doc
2018-10-01 21:19:41 +02:00
Grecko a15a86be81 chore: correct typo in a test 2018-10-01 21:18:39 +02:00
Grecko f08fd2eaed feat: Add FilterRole role type 2018-09-30 03:00:36 +02:00
Grecko 2b3a368ae1 feat: Add FilterSorter sorter type 2018-09-29 12:02:15 +02:00
Grecko 1ae65bca74 misc: set filters as the default property of SwitchRole 2018-09-28 22:16:41 +02:00
Grecko 51c6a62f4d fix SwitchRole compilation
closes #54
2018-08-28 00:13:24 +02:00
Grecko 3a55ea0d8c feat: Add RegExpRole proxy role type
Add support for multiple roles for one proxy role.
2018-08-08 01:37:20 +02:00
oKcerG d2772bd6e4
fix: compilation error due to bad includes
oops
2018-04-30 10:43:46 +02:00
Grecko 88b5ba4260 refactor: move proxyroles in separate files 2018-04-30 03:16:20 +02:00
Grecko 2ee1936545 refactor: move sorters in separate files 2018-04-30 03:15:52 +02:00
Grecko df41e94e45 refactor: move filters in separate files 2018-04-30 03:14:08 +02:00
Grecko febeade02b refactor: Add container interfaces for filters, sorters and roles 2018-04-30 03:13:46 +02:00
Grecko d844e7dcfd test: add tests for Filter containers 2018-04-24 01:49:08 +02:00
Grecko 8499099464 fix: Handle source model with no roles better
They are now handled in setSourceModel instead of resetInternalData
Fixes #46
2018-03-22 23:41:36 +01:00
Grecko 9c3e57c02e fix: don't call sourceData with an invalid role
This is related to bug #46
2018-03-22 23:36:59 +01:00
Grecko 6ff055d47d test: Add a test case for sorting on a model with no initial roles
This cause a crash when adding 2 rows to an empty ListModel
2018-03-22 19:16:00 +01:00
Grecko 6211989a48 test: Simplify IndexFilter tests 2017-12-01 00:40:52 +01:00
Kenn Sebesta 18218454e2 Include checkbox in README.md
This includes the missing checkbox component for the sorting demo.
2017-11-21 19:04:22 +01:00
oKcerG d1c46fd13f
doc: Add link to showcase in readme 2017-11-21 18:41:38 +01:00
Grecko 23faaeea22 doc: Regenerate the doc 2017-10-13 01:10:47 +02:00
mitchcurtis 26e2a983eb Fix ExpressionSorter docs (#45) 2017-10-13 00:50:57 +02:00
Grecko 15ccba1f14 doc: Regenerate the doc 2017-09-26 22:34:19 +02:00