Warning, /education/marble/src/apps/marble-maps/SearchResults.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Gábor Péterffy <peterffy95@gmail.com>
0004 // SPDX-FileCopyrightText: 2015 Mikhail Ivchenko <ematirov@gmail.com>
0005 //
0006
0007 import QtQuick 2.3
0008 import QtQuick.Controls 1.3
0009 import QtQuick.Window 2.2
0010
0011 Item {
0012 id: root
0013
0014 property var model: []
0015 property color background: palette.base
0016 property alias count: view.count
0017 property int delegateHeight: 0
0018
0019 signal itemSelected(int index, string name)
0020
0021 SystemPalette{
0022 id: palette
0023 colorGroup: SystemPalette.Active
0024 }
0025
0026 Rectangle {
0027 id: background
0028 anchors.fill: parent
0029 color: root.background
0030 }
0031
0032 ListView {
0033 id: view
0034 anchors.fill: parent
0035 clip: true
0036 snapMode: ListView.SnapToItem
0037 model: root.model
0038 delegate: Item {
0039 width: view.width
0040 height: placemarkName.height + 20
0041
0042 Rectangle {
0043 id: delegateBackground
0044 anchors.fill: parent
0045 color: mouseArea.pressed ? palette.highlight : root.background
0046 }
0047
0048 Image {
0049 id: icon
0050 anchors.left: parent.left
0051 anchors.leftMargin: 10
0052 anchors.verticalCenter: parent.verticalCenter
0053 width: height
0054 height: placemarkName.height
0055 source: iconPath.substr(0,1) === '/' ? "file://" + iconPath : iconPath
0056 sourceSize.width: width
0057 sourceSize.height: height
0058 fillMode: Image.Pad
0059 }
0060
0061 Text {
0062 id: placemarkName
0063 anchors.left: icon.right
0064 anchors.right: parent.right
0065 anchors.rightMargin: 10
0066 anchors.verticalCenter: parent.verticalCenter
0067 font.pointSize: 18
0068 color: palette.text
0069 text: name
0070 elide: Text.ElideMiddle
0071 }
0072
0073 MouseArea {
0074 id: mouseArea
0075 anchors.fill: parent
0076 onClicked: {
0077 root.itemSelected(index, name);
0078 }
0079 }
0080
0081 Component.onCompleted: {
0082 if( root.delegateHeight != height ) {
0083 root.delegateHeight = height;
0084 }
0085 }
0086 }
0087 }
0088
0089 MarbleScrollBar {
0090 id: scrollBar
0091 flickableItem: view
0092 }
0093 }