IntentModel QML Type
A proxy model for the IntentServer singleton. More...
Import Statement: | import QtApplicationManager.SystemUI 2.0 |
Properties
- count : int
- filterFunction : var
- sortFunction : var
Methods
- int indexOfIntent(string intentId, string applicationId, var parameters)
- int indexOfIntent(IntentObject intent)
- int mapFromSource(int index)
- int mapToSource(int index)
Detailed Description
The IntentModel type provides a customizable model that can be used to tailor the IntentServer model to your needs. The IntentServer singleton is a model itself, that includes all available intents. In contrast, the IntentModel supports filtering and sorting.
Since the IntentModel is based on the IntentServer model, the latter is referred to as the source model. The IntentModel includes the same roles as the IntentServer model.
Note: If you require a model with all intents, with no filtering whatsoever, you should use the IntentServer directly, as it has better performance.
The following code snippet displays the icons of all the intents belonging to the com.pelagicore.test
package:
import QtQuick 2.6 import QtApplicationManager.SystemUI 2.0 ListView { model: IntentModel { filterFunction: function(intent) { return intent.packageId == 'com.pelagicore.test' } } delegate: Image { source: icon } }
Property Documentation
count : int |
Holds the number of intents included in this model.
filterFunction : var |
A JavaScript function callback that is invoked for each intent in the IntentServer source model. This function gets one IntentObject parameter and must return a Boolean. If the intent passed should be included in this model, then the function must return true
; false
otherwise.
If you need no filtering at all, you should set this property to an undefined (the default) or null value.
Note: Whenever this function is changed, the filter is reevaluated. Changes in the source model are reflected. Since the type is derived from QSortFilterProxyModel, the invalidate() slot can be used to force a reevaluation.
sortFunction : var |
A JavaScript function callback that is invoked to sort the intents in this model. This function gets two IntentObject parameters and must return a Boolean. If the first intent should have a smaller index in this model than the second, the function must return true
; false
otherwise.
If you need no sorting at all, you should set this property to an undefined (the default) or null value.
Note: Whenever this function is changed, the model is sorted. Changes in the source model are reflected. Since the type is derived from QSortFilterProxyModel, the invalidate() slot can be used to force a sort.
Method Documentation
Maps the intent corresponding to the given intentId, applicationId and parameters to its position within this model. Returns -1
if the specified intent is invalid, or not part of this model.
int indexOfIntent(IntentObject intent) |
Maps the intent to its position within this model. Returns -1
if the specified intent is invalid, or not part of this model.
Maps an intenet's index from the IntentServer model to the corresponding index in this model. Returns -1
if the specified index is invalid.
Maps an intent's index in this model to the corresponding index in the IntentServer model. Returns -1
if the specified index is invalid.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.