Warning, /education/marble/examples/qml/google-search/google-search.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 import Qt 4.7
0007 import org.kde.marble 0.20
0008 
0009 Rectangle {
0010     width: 700
0011     height: 700
0012 
0013     SystemPalette { id: activePalette }
0014 
0015     Image {
0016         x: 113
0017         y: 0
0018         source: "marble.png"
0019         anchors.horizontalCenter: parent.horizontalCenter
0020     }
0021 
0022     Rectangle {
0023         id: searchinput
0024         x: 38
0025         y: 117
0026         width: 565
0027         height: 49
0028         border.color: "black"
0029         border.width: 1
0030         anchors.horizontalCenter: parent.horizontalCenter
0031 
0032         TextInput {
0033             anchors.fill: parent
0034             anchors.margins: 10
0035             id: searchterm
0036             text: ""
0037             font.pointSize: 18
0038             focus: true
0039         }
0040     }
0041 
0042     Item {
0043         id: buttonlayouter
0044         anchors.top: searchinput.bottom
0045         anchors.horizontalCenter: parent.horizontalCenter
0046         anchors.margins: 10
0047         height: button1.height
0048 
0049         Button {
0050             id: button1
0051             anchors.right: buttonlayouter.horizontalCenter
0052             anchors.margins: 10
0053             width: 126
0054             height: 25
0055             label: "Marble Search"
0056 
0057             onClicked: { map.search.find( searchterm.text ) }
0058         }
0059 
0060         Button {
0061             id: button2
0062             anchors.left: buttonlayouter.horizontalCenter
0063             anchors.margins: 10
0064             width: 140
0065             height: 25
0066             label: "I'm Feeling Lucky"
0067         }
0068     }
0069 
0070     Item {
0071         id: mapcontainer
0072         width: 600
0073         height: 400
0074         anchors.horizontalCenter: buttonlayouter.horizontalCenter
0075         anchors.top: buttonlayouter.bottom
0076         anchors.margins: 30
0077         clip: true
0078 
0079         MarbleWidget {
0080             id: map
0081             width: 600
0082             height: 400
0083             activeRenderPlugins: [ "navigation", "scalebar" ]
0084 
0085             property Search search: Search {
0086                 map: map
0087                 placemarkDelegate: myDelegate
0088             }
0089         }
0090 
0091         Component {
0092             id: myDelegate
0093 
0094             Image {
0095                 source: "marker.svg"
0096                 fillMode: Image.PreserveAspectFit
0097                 width: 64;
0098                 height: 64
0099 
0100                 property bool showDetails: false
0101 
0102                 Text {
0103                     anchors.horizontalCenter: parent.horizontalCenter
0104                     anchors.bottom: parent.bottom
0105                     width: parent.width
0106                     height: parent.height
0107                     wrapMode: Text.WrapAtWordBoundaryOrAnywhere
0108                     color: "white"
0109                     text: index+1
0110                     horizontalAlignment: Text.AlignHCenter
0111                 }
0112 
0113                 Rectangle
0114                 {
0115                     anchors.left: parent.right
0116                     id: itemdetails
0117                     scale: 0.75
0118                     width: 140
0119                     height: 60
0120                     color: "yellow"
0121                     radius: 10
0122                     border.width: 1
0123                     border.color: "gray"
0124                     z: 42
0125 
0126                     visible: parent.showDetails
0127 
0128                     Text {
0129                         id: itemdetailtext
0130                         x: 10
0131                         y: 5
0132                         width: parent.width - 20
0133                         height: parent.height - 10
0134                         text: display
0135                         wrapMode: "WrapAtWordBoundaryOrAnywhere"
0136                         clip: true
0137                     }
0138 
0139                     states: State {
0140                         name: "back"
0141                         PropertyChanges { target: itemdetails; scale: 1 }
0142                         when: itemdetailtext.visible
0143                     }
0144 
0145                     transitions: Transition {
0146                         NumberAnimation { properties: "scale"; duration: 100 }
0147                     }
0148                 }
0149 
0150                 MouseArea {
0151                     anchors.fill: parent
0152                     onClicked: showDetails = !showDetails
0153                 }
0154             }
0155         }
0156     }
0157 }