Commit 2da77d40 authored by Swapnil Tripathi's avatar Swapnil Tripathi Committed by Aleix Pol Gonzalez
Browse files

Use drawers in place of overlay sheet in graphs

parent 70366f34
......@@ -67,6 +67,12 @@ KAlgebraPage {
}
//custom viewport?
]
actions.main: Kirigami.Action {
icon.name: 'list-add'
text: i18n('Add Plot')
onTriggered: plotDialog.open()
}
Rectangle {
anchors.fill: parent
......@@ -77,50 +83,9 @@ KAlgebraPage {
id: view
anchors.fill: parent
model: App.functionsModel()
Kirigami.OverlaySheet {
id: dialog
header: RowLayout {
width: parent.width
ExpressionInput {
id: input
Layout.fillWidth: true
text: "sin x"
focus: true
Component.onCompleted: selectAll()
onAccepted: {
input.selectAll()
view.addFunction(input.text, App.variables)
}
}
Button {
icon.name: "list-add"
onClicked: {
input.selectAll()
view.addFunction(input.text, App.variables)
}
}
}
contentItem: Kirigami.CardsListView {
delegate: Kirigami.Card { contentItem: Label { text: model.description } }
model: App.functionsModel()
footer: Button {
text: i18n("Clear All")
onClicked: {
App.functionsModel().clear();
view.resetViewport();
}
}
}
}
AddButton {
onClicked: {
dialog.open();
}
Add2DDialog {
id: plotDialog
}
}
}
}
}
\ No newline at end of file
......@@ -41,7 +41,7 @@ KAlgebraPage {
}
contextualActions: [
Action {
Kirigami.Action {
text: i18n("Save")
onTriggered: {
fileDialog.title = text
......@@ -54,68 +54,24 @@ KAlgebraPage {
fileDialog.open()
}
},
Action {
Kirigami.Action {
text: i18n("Reset Viewport")
onTriggered: view.resetViewport()
}
]
Graph3D
{
actions.main: Kirigami.Action {
icon.name: 'list-add'
text: i18n('Add Plot')
onTriggered: plotDialog.open()
}
Graph3D {
id: view
anchors.fill: parent
model: App.functionsModel()
Kirigami.OverlaySheet {
id: dialog
header: RowLayout {
width: parent.width
ExpressionInput {
id: input
Layout.fillWidth: true
text: "sin x*sin y"
focus: true
Component.onCompleted: selectAll()
onAccepted: {
input.selectAll()
var err = App.functionsModel().addFunction(input.text, 4, App.variables)
if (err.length>0)
console.warn("errors:", err)
}
}
Button {
icon.name: "list-add"
onClicked: {
input.selectAll()
var err = view.addFunction(input.text, App.variables)
if (err.length>0)
console.warn("errors:", err)
}
}
}
contentItem: Kirigami.CardsListView {
id: list
delegate: Kirigami.Card {
contentItem: Label { text: model.description }
}
model: view.model
footer: Button {
text: i18n("Clear All")
onClicked: {
view.model.clear()
view.resetView()
}
}
}
}
AddButton {
onClicked: {
dialog.open();
}
Add3DDialog {
id: plotDialog
}
}
}
// SPDX-FileCopyrightText: 2021 Swapnil Tripathi <swapnil06.st@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.8 as Kirigami
import org.kde.analitza 1.0
import org.kde.kalgebra.mobile 1.0
Kirigami.OverlayDrawer {
id: drawer
parent: page
height: parent.height / 2
edge: Qt.BottomEdge
z: -1
Behavior on height {
NumberAnimation { duration: Kirigami.Units.shortDuration }
}
contentItem: ColumnLayout {
anchors.fill: parent
ToolBar {
Layout.fillWidth: true
RowLayout {
anchors.fill: parent
ExpressionInput {
id: input
Layout.fillWidth: true
text: "sin x"
focus: true
Component.onCompleted: selectAll()
Keys.onReturnPressed: {
input.selectAll()
view.addFunction(input.text, App.variables)
}
}
Button {
icon.name: "list-add"
onClicked: {
input.selectAll()
view.addFunction(input.text, App.variables)
}
}
Button {
text: i18n("Clear All")
onClicked: {
App.functionsModel().clear();
view.resetViewport();
}
}
Button {
icon.name: "collapse"
onClicked: {
drawer.close()
}
}
}
}
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
model: App.functionsModel()
delegate: Kirigami.SwipeListItem {
contentItem: Label {
text: model.description
}
}
}
}
}
}
// SPDX-FileCopyrightText: 2021 Swapnil Tripathi <swapnil06.st@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.8 as Kirigami
import org.kde.analitza 1.0
import org.kde.kalgebra.mobile 1.0
Kirigami.OverlayDrawer {
id: drawer
parent: page
height: parent.height / 2
edge: Qt.BottomEdge
z: -1
Behavior on height {
NumberAnimation { duration: Kirigami.Units.shortDuration }
}
contentItem: ColumnLayout {
anchors.fill: parent
ToolBar {
Layout.fillWidth: true
RowLayout {
anchors.fill: parent
ExpressionInput {
id: input
Layout.fillWidth: true
text: "sin x*sin y"
focus: true
Component.onCompleted: selectAll()
Keys.onReturnPressed: {
input.selectAll()
var err = App.functionsModel().addFunction(input.text, 4, App.variables)
if (err.length>0)
console.warn("errors:", err)
}
}
Button {
icon.name: "list-add"
onClicked: {
input.selectAll()
var err = view.addFunction(input.text, App.variables)
if (err.length>0)
console.warn("errors:", err)
}
}
Button {
text: i18n("Clear All")
onClicked: {
App.functionsModel().clear();
view.resetViewport();
}
}
Button {
icon.name: "collapse"
onClicked: {
drawer.close()
}
}
}
}
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
model: App.functionsModel()
delegate: Kirigami.SwipeListItem {
contentItem: Label {
text: model.description
}
}
}
}
}
}
......@@ -17,5 +17,7 @@
<file alias="RealInput.qml">content/ui/controls/RealInput.qml</file>
<file alias="ExpressionInput.qml">content/ui/controls/ExpressionInput.qml</file>
<file alias="AddButton.qml">content/ui/controls/AddButton.qml</file>
<file alias="Add2DDialog.qml">content/ui/controls/Add2DDialog.qml</file>
<file alias="Add3DDialog.qml">content/ui/controls/Add3DDialog.qml</file>
</qresource>
</RCC>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment