Kstars

ProjectionsPopup.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick.Controls 2.0
5import QtQuick 2.6
6import QtQuick.Layouts 1.1
7import "../../constants" 1.0
8import "../../modules"
9import KStarsLiteEnums 1.0
10
11Popup {
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:47
This is the main item that displays all SkyItems.
Definition skymaplite.h:59
Q_INVOKABLE uint projType() const
used in QML
Q_INVOKABLE void setProjection(uint proj)
setProjection calls Options::setProjection(proj) and updates SkyMapLite
QString xi18n(const char *text, const TYPE &arg...)
QString name(StandardAction id)
const QList< QKeySequence > & close()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.