SortFilterModel: No complex "OR" or "AND" filtering possible

Bug #1488823 reported by Didier Roche-Tolomelli
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

No complex OR/AND functionality in SortFilterModel seems to be available.

A typical usage would be a search query trying to search matches through different fields of a model (title, comments…). I guess this common pattern would be interesting to have it implementing.

Current solution is either to go C++ or use a javascript worker to not block the UI.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: qtdeclarative5-ubuntu-ui-toolkit-plugin 1.3.1603+15.10.20150812-0ubuntu1
ProcVersionSignature: Ubuntu 4.1.0-3.3-generic 4.1.3
Uname: Linux 4.1.0-3-generic x86_64
ApportVersion: 2.18-0ubuntu7
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Aug 26 10:15:32 2015
InstallationDate: Installed on 2012-05-28 (1184 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
SourcePackage: ubuntu-ui-toolkit
UpgradeStatus: Upgraded to wily on 2014-10-31 (298 days ago)

Tags: devexp
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :
Revision history for this message
Cris Dywan (kalikiana) wrote :

The behavior exposed to QML is identical to what QSortFilterProxyModel offers - what you can't do in QML is override filterAcceptsRow or lessThan respectively. So the question becomes what use cases to support in a way that doesn't become potentially slow Javascripts running whenever the model changes.
See http://doc.qt.io/qt-5.4/qsortfilterproxymodel.html#filterAcceptsRow

We could potentially allow setting a list like sort.property ["foo", "bar"] if we assume the search term to be one, but that may not be enough? Some sample use cases might be good.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
Cris Dywan (kalikiana)
Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Undecided → Low
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

A simple case is having a listview model, and a search bar.

I want the search bar to match any field of my model (so that then, my listview just show the matches). In addition, I have a sort property to sort the model.

    SortFilterModel {
        id: currentmodel
        model: billsHandler.billsResults
        sort.property: "timestamp"
        sort.order: Qt.DescendingOrder
    }

We can imagine adding here, as you say:
filter.property ["foo", "bar"]
to match any "query" search term anywhere in "foo" or "bar". Does it make sense to you?

summary: - SortFilterModel: No complex "OR" or "AND" sorting possible
+ SortFilterModel: No complex "OR" or "AND" filtering possible
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.