Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QContentSortCriteria class defines the attributes and order a QContentSet should be sorted by. More...
#include <QContentSortCriteria>
The QContentSortCriteria class defines the attributes and order a QContentSet should be sorted by.
The sorting criteria is an ordered list of QContent attributes and sort orders which can be used to compare two QContents. When a comparison is made between QContents each attribute in the sorting criteria is compared in order until one that is not equal is found and the result of that comparison is returned. If all comparisons are equal the sorting criteria will fall back to the user visible name, and then the content id in ascending order to make a comparison. A comparison with a null QContent will always return the null QContent as the lesser one.
When sorting by a property it is also necessary to provide an attribute scope to specify the group and key of the property that are sorted on. The scope should be a string of the form [group]/[key]. Alternatively if the property belongs to the QContent::Property enumeration that may be used instead of an attribute.
Using the sort criteria a content set containing music sorted by artist, album, and track number could be created as below:
QContentSet music; music.setCriteria( QContentFilter::mimeType( "audio/mpeg" ) ); QContentSortCriteria sort; sort.addSort( QContentSortCriteria::Property, "none/Artist" ); sort.addSort( QContentSortCriteria::Property, "none/Album" ); sort.addSort( QContentSortCriteria::Property, "none/Track" ); music.setSortCriteria( sort );
The Attribute enumeration defines an attribute of a QContent that a comparison should be made on.
Constant | Value | Description |
---|---|---|
QContentSortCriteria::Name | 0 | The user visible name of the content. |
QContentSortCriteria::MimeType | 1 | The type of the content. |
QContentSortCriteria::Property | 2 | A property of the content. The group and key for the property must be supplied as an scope of the sort as a string of the form [group]/[key] |
QContentSortCriteria::FileName | 3 | The file name of the content. |
QContentSortCriteria::LastUpdated | 4 | The time and date the content record was last updated. |
Constructs a null sort criteria.
Constructs a sort criteria that sorts a set by an attribute in the given sort order.
Constructs a sort criteria that sorts a set by an attribute with a scope in the given sort order.
Constructs a sort criteria that sorts a set by property in the given sort order.
Constructs a copy of the sort criteria other.
Destroys a sort criteria.
Adds an attribute to sort by in the given order to the end of the sort criteria.
This is an overloaded member function, provided for convenience.
Adds an attribute with a scope to sort by in the given order to the end of the sort criteria.
This is an overloaded member function, provided for convenience.
Adds a property to sort by in the given order to the end of the sort criteria.
Returns the attribute sorted by at the given index.
Removes all sorts from the sorting criteria.
Compares the left and right contents using the sorting criteria and returns a negative integer if the left is less than the right, a positive integer if the left is greater than the right, and zero if they are equivalent.
Compares the left and right contents using the sorting criteria and returns true if the left is greater than the right and false otherwise.
Compares the left and right contents using the sorting criteria and returns true if the left is less than the right and false otherwise.
Returns the order the attribute at the given index is sorted by.
Returns the scope of the attribute sorted by at the given index.
Returns the number of attributes the sorting criteria sorts on.
Compares other to a sort criteria. Returns true if it is not equal; false otherwise.
Assigns the value of other to a sort criteria.
Compares other to a sort criteria. Returns true if it is equal; false otherwise.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |