Warning, /education/kalgebra/mobile/content/ui/Plot2D.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2015 by Aleix Pol <aleixpol@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtCore
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Dialogs
0008 import QtQuick.Controls as QQC2
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.analitza
0011 import org.kde.kalgebra.mobile
0012 
0013 Kirigami.Page {
0014     id: page
0015 
0016     leftPadding: 0
0017     rightPadding: 0
0018     topPadding: 0
0019     bottomPadding: 0
0020 
0021     title: i18nc("@title:window", "2D Plot")
0022 
0023     FileDialog {
0024         id: fileDialog
0025         currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
0026         onAccepted: proceed()
0027 
0028         property var proceed
0029     }
0030 
0031     actions: [
0032         QQC2.Action {
0033             icon.name: 'list-add'
0034             text: i18n('Add Plot')
0035             onTriggered: plotDialog.open()
0036         },
0037         QQC2.Action {
0038             text: i18n("Save")
0039             icon.name: 'document-save'
0040             onTriggered: {
0041                 fileDialog.title = text
0042                 fileDialog.proceed = function() {
0043                     var ret = view.save(fileDialog.fileUrl)
0044                     console.log("saved 2D", fileDialog.fileUrl, ret)
0045                 }
0046                 fileDialog.nameFilters = view.filters
0047                 fileDialog.selectExisting = false
0048                 fileDialog.open()
0049             }
0050         },
0051         QQC2.Action {
0052             text: i18n("View Grid")
0053             icon.name: 'view-grid'
0054             checkable: true
0055             checked: view.showGrid
0056             onToggled: view.showGrid = checked
0057         },
0058         QQC2.Action {
0059             icon.name: 'view-restore'
0060             text: i18n("Reset Viewport")
0061             onTriggered: view.resetViewport()
0062         }
0063         //custom viewport?
0064     ]
0065 
0066     Rectangle {
0067         anchors.fill: parent
0068         color: 'white'
0069 
0070         Graph2D {
0071             id: view
0072             anchors.fill: parent
0073             model: App.functionsModel()
0074             AddPlotDialog {
0075                 id: plotDialog
0076                 text: "sin x"
0077                 dimension: 2
0078             }
0079         }
0080     }
0081 }