/* blueROCK - for digital rock Copyright (C) 2019 Dorian Zedler This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import QtQuick 2.0 import QtQuick.Controls 2.4 import "../Components" Page { id: root title: "search athlete" property Component headerComponent: null property var searchResults: ({}) function search(term){ loadingDl.open() root.searchResults = serverConn.getWidgetData({term:term}).data loadingDl.close() } ListView { anchors.fill: parent anchors.topMargin: searchTf.height anchors.margins: 10 clip: true model: root.searchResults.length delegate: ItemDelegate { width: parent.width text: root.searchResults[index]['label'] onClicked: app.openWidget({person: root.searchResults[index]['value']}) } } TextField { id: searchTf anchors { top: parent.top left: parent.left right: parent.right margins: 10 } Keys.onReturnPressed: { console.warn(searchTf.text) root.search("*" + searchTf.text + "*") } } }