• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • apps
  • marble-touch
ViaPointEditor.qml
Go to the documentation of this file.
1 // This file is part of the Marble Virtual Globe.
2 //
3 // This program is free software licensed under the GNU LGPL. You can
4 // find a copy of this license in LICENSE.txt in the top directory of
5 // the source code.
6 //
7 // Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org>
8 
9 import QtQuick 1.0
10 import com.nokia.meego 1.0
11 
12 Item {
13  id: root
14  height: row.height
15 
16  property string text: "Point in map"
17  property bool isCurrentPosition: false
18 
19  signal positionChanged(int index, real lon, real lat)
20 
21  property bool _editing: false
22 
23  function retrieveInput( lon, lat ) {
24  if ( _editing ) {
25  _editing = false
26  positionChanged(index, lon, lat)
27  }
28  }
29 
30  Item {
31  id: row
32  width: parent.width
33  height: Math.max(waypointIcon.height, destinationInputLabel.height)
34 
35  Rectangle {
36  id: waypointIcon
37  anchors.verticalCenter: parent.verticalCenter
38  anchors.left: parent.left
39  anchors.leftMargin: 5
40  width: 32
41  height: 32
42  radius: 16
43  color: "#37A42C"
44  border.width: 1
45  border.color: "black"
46 
47  Text {
48  anchors.centerIn: parent
49  text: String.fromCharCode(65+index)
50  font.pixelSize: 24
51  verticalAlignment: Text.AlignVCenter
52  horizontalAlignment: Text.AlignHCenter
53  }
54  }
55 
56  Label {
57  id: destinationInputLabel
58  anchors.left: waypointIcon.right
59  anchors.right: editIcon.left
60  anchors.verticalCenter: parent.verticalCenter
61  anchors.margins: 10
62  text: root._editing ? "Select a point" : ( root.isCurrentPosition ? "Current position" : root.text )
63  }
64 
65  MouseArea {
66  anchors.fill: parent
67  onClicked: marbleWidget.centerOn(longitude, latitude)
68  }
69 
70  MarbleToolIcon {
71  id: editIcon
72  iconSource: main.icon( "actions/document-edit", 32 );
73  width: 32
74  height: width
75  anchors.right: parent.right
76  anchors.margins: 5
77  anchors.verticalCenter: parent.verticalCenter
78  onClicked: {
79  inputSelectionDialog.open()
80  }
81  }
82  }
83 
84  SelectionDialog {
85  id: inputSelectionDialog
86  titleText: "Select via point"
87  selectedIndex: -1
88  model: ListModel {
89  ListElement { name: "Current Position" }
90  ListElement { name: "Choose Bookmark" }
91  ListElement { name: "Select from map" }
92  }
93 
94  onAccepted: {
95  if ( selectedIndex === 0 ) {
96  root.isCurrentPosition = true
97  root.positionChanged(index, marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude)
98  } else if ( selectedIndex === 1 ) {
99  bookmarkSelectionDialog.open()
100  } else {
101  root.isCurrentPosition = false
102  root._editing = true
103  }
104  }
105  }
106 
107  SelectionDialog {
108  id: bookmarkSelectionDialog
109  titleText: "Select Bookmark"
110  model: marbleWidget.bookmarks.model
111  onAccepted: {
112  root.text = marbleWidget.bookmarks.model.name(selectedIndex)
113  root.positionChanged(index, marbleWidget.bookmarks.model.longitude(selectedIndex), marbleWidget.bookmarks.model.latitude(selectedIndex))
114  }
115  }
116 
117  onIsCurrentPositionChanged: {
118  inputSelectionDialog.selectedIndex = isCurrentPosition ? 0 : 1
119  }
120 }
ListModel
Rectangle
Item
MarbleWindow::icon
void icon(name, size)
MarbleToolIcon
Definition: harmattan/MarbleToolIcon.qml:10
main
Definition: main.qml:12
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal