summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2016-10-04 01:15:08 (GMT)
committerAleix Pol <aleixpol@kde.org>2016-10-04 01:15:08 (GMT)
commit89c6e000d1bcd18ed878eea6f8a5cebbe80e44d4 (patch)
tree9e9b4878c5a400ca16294ec15057a917896d9269
parentece94f9c3017d936b212ebb6bb1ad5027657f901 (diff)
Improve Kirigami usage
-rw-r--r--mobile/plugins/widgets/kde/AddButton.qml21
-rw-r--r--mobile/plugins/widgets/kde/CMakeLists.txt4
-rw-r--r--mobile/plugins/widgets/kde/ConsoleDelegate.qml28
-rw-r--r--mobile/plugins/widgets/kde/Dialog.qml8
-rw-r--r--mobile/plugins/widgets/kde/KAlgebraMobile.qml4
-rw-r--r--mobile/plugins/widgets/kde/KAlgebraPage.qml5
-rw-r--r--mobile/plugins/widgets/kde/Keyboard.qml45
7 files changed, 37 insertions, 78 deletions
diff --git a/mobile/plugins/widgets/kde/AddButton.qml b/mobile/plugins/widgets/kde/AddButton.qml
new file mode 100644
index 0000000..c60f011
--- /dev/null
+++ b/mobile/plugins/widgets/kde/AddButton.qml
@@ -0,0 +1,21 @@
+import org.kde.kirigami 1.0 as Kirigami
+import QtQuick 2.1
+
+Item
+{
+ id: root
+ signal clicked
+
+ readonly property var act: Kirigami.Action {
+ id: action
+ iconName: "list-add"
+ onTriggered: root.clicked()
+ }
+
+ Component.onCompleted: {
+ var page = parent
+ for (; page && page.title === undefined; page = page.parent) {}
+
+ page.mainAction = action
+ }
+}
diff --git a/mobile/plugins/widgets/kde/CMakeLists.txt b/mobile/plugins/widgets/kde/CMakeLists.txt
index d53a16f..92b6703 100644
--- a/mobile/plugins/widgets/kde/CMakeLists.txt
+++ b/mobile/plugins/widgets/kde/CMakeLists.txt
@@ -1,12 +1,12 @@
install( FILES
- Keyboard.qml SimpleListView.qml
+ SimpleListView.qml Dialog.qml AddButton.qml
KAlgebraPage.qml KAlgebraMobile.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
)
install(FILES
- ../qtcontrols/AddButton.qml ../qtcontrols/ComboBox.qml ../qtcontrols/Dialog.qml ../qtcontrols/Label.qml
+ ../qtcontrols/ComboBox.qml ../qtcontrols/Label.qml
../qtcontrols/Button.qml ../qtcontrols/CalcButton.qml ../qtcontrols/RealInput.qml ../qtcontrols/ExpressionInput.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
diff --git a/mobile/plugins/widgets/kde/ConsoleDelegate.qml b/mobile/plugins/widgets/kde/ConsoleDelegate.qml
deleted file mode 100644
index 104eacf..0000000
--- a/mobile/plugins/widgets/kde/ConsoleDelegate.qml
+++ /dev/null
@@ -1,28 +0,0 @@
-import QtQuick 2.0
-
-Component {
- Row {
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: 10
- Text {
- id:exp
- text: result
- }
-
-// Rectangle {
-// color: "blue"
-// anchors.top: parent.top
-// anchors.bottom: parent.bottom
-// width: parent.height
-// }
-//
-// Rectangle {
-// Text {
-// text: value
-// // color: "green"
-// anchors.fill: parent
-// }
-// color: "blue"
-// }
- }
-}
diff --git a/mobile/plugins/widgets/kde/Dialog.qml b/mobile/plugins/widgets/kde/Dialog.qml
new file mode 100644
index 0000000..7e18c2b
--- /dev/null
+++ b/mobile/plugins/widgets/kde/Dialog.qml
@@ -0,0 +1,8 @@
+import org.kde.kirigami 1.0
+
+OverlaySheet {
+ default property var fu
+ contentItem: fu
+
+ topPadding: 500
+}
diff --git a/mobile/plugins/widgets/kde/KAlgebraMobile.qml b/mobile/plugins/widgets/kde/KAlgebraMobile.qml
index 2ef5ef5..7d55dc2 100644
--- a/mobile/plugins/widgets/kde/KAlgebraMobile.qml
+++ b/mobile/plugins/widgets/kde/KAlgebraMobile.qml
@@ -29,9 +29,7 @@ ApplicationWindow
}
try {
- rootItem.pageStack.clear();
- var obj = component.createObject(component);
- rootItem.pageStack.push(obj)
+ rootItem.pageStack.replace(component)
} catch(e) {
console.log("error", e)
}
diff --git a/mobile/plugins/widgets/kde/KAlgebraPage.qml b/mobile/plugins/widgets/kde/KAlgebraPage.qml
index 9bde5dd..1d03d82 100644
--- a/mobile/plugins/widgets/kde/KAlgebraPage.qml
+++ b/mobile/plugins/widgets/kde/KAlgebraPage.qml
@@ -7,6 +7,11 @@ Page
title: "KAlgebra"
default property alias contents: item.data
+ leftPadding: 0
+ rightPadding: 0
+ topPadding: 0
+ bottomPadding: 0
+
Item {
id: item
anchors.fill: parent
diff --git a/mobile/plugins/widgets/kde/Keyboard.qml b/mobile/plugins/widgets/kde/Keyboard.qml
deleted file mode 100644
index e92f118..0000000
--- a/mobile/plugins/widgets/kde/Keyboard.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-
-Row {
- signal clear
-
- Grid {
- id:nums
- columns: 3
- rows: 4
- height: 300
- anchors.top: parent.top
- anchors.bottom: parent.bottom
-
- signal newInput(string text)
- signal deleteChar
-
- CalcButton { text: "1" }
- CalcButton { text: "2" }
- CalcButton { text: "3" }
- CalcButton { text: "4" }
- CalcButton { text: "5" }
- CalcButton { text: "6" }
- CalcButton { text: "7" }
- CalcButton { text: "8" }
- CalcButton { text: "9" }
- CalcButton { text: "." }
- CalcButton { text: "0" }
- }
-
- Flow {
- flow: Flow.TopToBottom
-
- CalcButton { text: "-" }
- CalcButton { text: "+" }
- CalcButton { text: "*" }
- CalcButton { text: "/" }
- CalcButton { text: "(" }
- CalcButton { text: ")" }
-
- Button { text: "AC"; onClicked: clear();}
-
- anchors.bottom: nums.bottom
- anchors.top: nums.top
- }
-} \ No newline at end of file