summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2015-10-05 15:18:04 +0200
committerAleix Pol <[email protected]>2015-10-05 15:18:04 +0200
commit19a775587976cc5f49854c48b2cdb34a2a7eb268 (patch)
treef0398009928f1cbe64d2210423c92a7be2319663
parent407a89b61d78a62e8f8add3a76ea26c919a49b79 (diff)
Improve material integration
Add elevation to the buttons Don't overlap the + and - buttons on the input field Ensure there's a scrollbar on the simple list
-rw-r--r--mobile/plugins/widgets/material/Button.qml1
-rw-r--r--mobile/plugins/widgets/material/RealInput.qml83
-rw-r--r--mobile/plugins/widgets/material/SimpleListView.qml4
3 files changed, 47 insertions, 41 deletions
diff --git a/mobile/plugins/widgets/material/Button.qml b/mobile/plugins/widgets/material/Button.qml
index 0dcd077..3ec6bc6 100644
--- a/mobile/plugins/widgets/material/Button.qml
+++ b/mobile/plugins/widgets/material/Button.qml
@@ -1,4 +1,5 @@
import Material 0.1
Button {
+ elevation: 1
}
diff --git a/mobile/plugins/widgets/material/RealInput.qml b/mobile/plugins/widgets/material/RealInput.qml
index 71e8fd7..244c0c9 100644
--- a/mobile/plugins/widgets/material/RealInput.qml
+++ b/mobile/plugins/widgets/material/RealInput.qml
@@ -1,46 +1,47 @@
import Material 0.1
import QtQuick 2.0
+import QtQuick.Layouts 1.0
-TextField
+RowLayout
{
- id: input
- property alias minimumValue: realvalidator.bottom
- property alias maximumValue: realvalidator.top
-
- property double value: parseFloat(text)
- inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
-
- validator: DoubleValidator { id: realvalidator }
-
- onTextChanged: value=parseFloat(text)
-
- Component.onCompleted: text=value
-
- Row {
- anchors {
- right: parent.right
- rightMargin: 2
- }
- spacing: 2
- height: parent.height-4
- y:2
- Button {
- text: "+"
- height: parent.height
- onClicked: {
- if(input.value+1<maximumValue) {
- input.text=(input.value+1)
- }
- }
- }
- Button {
- text: "-"
- onClicked: {
- if(input.value-1>minimumValue) {
- input.text=(input.value-1)
- }
- }
- height: parent.height
- }
- }
+ property alias text: input.text
+ property alias minimumValue: realvalidator.bottom
+ property alias maximumValue: realvalidator.top
+ readonly property double value: parseFloat(input.text)
+
+ signal accepted()
+
+ TextField
+ {
+ id: input
+ Layout.fillWidth: true
+
+ inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
+
+ validator: DoubleValidator { id: realvalidator }
+
+ Component.onCompleted: text=value
+
+ onAccepted: parent.accepted()
+ }
+
+ Button {
+ text: "+"
+ elevation: 1
+ onClicked: {
+ if(input.value+1<maximumValue) {
+ input.text=(input.value+1)
+ }
+ }
+ }
+
+ Button {
+ text: "-"
+ elevation: 1
+ onClicked: {
+ if(input.value-1>minimumValue) {
+ input.text=(input.value-1)
+ }
+ }
+ }
}
diff --git a/mobile/plugins/widgets/material/SimpleListView.qml b/mobile/plugins/widgets/material/SimpleListView.qml
index 3887846..d07042c 100644
--- a/mobile/plugins/widgets/material/SimpleListView.qml
+++ b/mobile/plugins/widgets/material/SimpleListView.qml
@@ -12,4 +12,8 @@ ListView
text: ListView.view.title
}
delegate: ListItem.Standard { text: model[role] }
+
+ Scrollbar {
+ flickableItem: viewItem
+ }
}