Kstars

ProjectionsPopup.qml
1 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 import QtQuick.Controls 2.0
5 import QtQuick 2.6
6 import QtQuick.Layouts 1.1
7 import "../../constants" 1.0
8 import "../../modules"
9 import KStarsLiteEnums 1.0
10 
11 Popup {
12  id: projPopup
13  focus: true
14  modal: true
15  width: projList.implicitWidth
16  height: parent.height > projList.implicitHeight ? projList.implicitHeight : parent.height
17 
18  background: Rectangle {
19  anchors.fill: parent
20  color: Num.sysPalette.base
21  }
22 
23  KSListView {
24  id: projList
25  anchors {
26  fill: parent
27  centerIn: parent
28  }
29  checkCurrent: true
30 
31  model: ListModel {
32  id: projModel
33  Component.onCompleted: {
34  projModel.append({ name: xi18n("Lambert (Default)"), proj: Projection.Lambert });
35  projModel.append({ name: xi18n("Azimuthal Equidistant"), proj: Projection.AzimuthalEquidistant });
36  projModel.append({ name: xi18n("Orthographic"), proj: Projection.Orthographic });
37  projModel.append({ name: xi18n("Equirectangular"), proj: Projection.Equirectangular });
38  projModel.append({ name: xi18n("Stereographic"), proj: Projection.Stereographic });
39  projModel.append({ name: xi18n("Gnomonic"), proj: Projection.Gnomonic });
40 
41  //Initialize projector
42  for(var i = 0; i < projList.model.count; ++i) {
43  if(projList.model.get(i).proj == SkyMapLite.projType()) {
44  projList.currentIndex = i
45  }
46  }
47  }
48  }
49 
50  onClicked: {
51  var item = projModel.get(projList.currentIndex)
52  KStarsLite.setProjection(item.proj)
53  skyMapLite.notification.showNotification("Set projection system to "
54  + item.name)
55  close()
56  }
57 
58  textRole: "name"
59  }
60 }
This class loads QML files and connects SkyMapLite and KStarsData Unlike KStars class it is not a mai...
Definition: kstarslite.h:46
Q_INVOKABLE uint projType() const
used in QML
const QList< QKeySequence > & close()
QString xi18n(const char *text, const TYPE &arg...)
Item for displaying sky objects; also handles user interaction events.
Definition: skymaplite.h:58
QString name(StandardShortcut id)
Q_INVOKABLE void setProjection(uint proj)
setProjection calls Options::setProjection(proj) and updates SkyMapLite
Definition: kstarslite.cpp:398
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Aug 14 2022 04:13:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.