Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ListView {
- property variant selectedPath: []
- onSelectionChanged: {
- if (selected)
- selectedPath = indexPath;
- else
- selectedPath = [];
- }
- onTriggered: {
- if (equalPaths(selected(), indexPath)) {
- select(indexPath, false);
- }
- else {
- clearSelection();
- select(indexPath, true);
- }
- }
- //--------------------------------------
- // Compare two indexPaths as returned by ListView.selected()
- // and other routines, returning true only if they're identical.
- //
- function equalPaths(ip1, ip2) {
- if (!ip1 || !ip2)
- return false;
- if (ip1.length != ip2.length)
- return false;
- for (var i = 0; i < ip1.length; i++)
- if (ip1[i] != ip2[i])
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement