Fix page margins in preferences and cloudcredentials

- page margins are gridUnit / 2, consistent with other pages
- Simplify layout: we don't need to nest that much here, saves two
  objects and simplifies code a bit

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2015-12-08 03:11:19 +01:00
parent 531eace0c3
commit 339ff4f259
2 changed files with 59 additions and 55 deletions

View file

@ -16,8 +16,11 @@ Item {
property bool issave: savePassword.checked; property bool issave: savePassword.checked;
ColumnLayout { ColumnLayout {
anchors.fill: parent
anchors.margins: MobileComponents.Units.gridUnit anchors {
fill: parent
margins: MobileComponents.Units.gridUnit / 2
}
MobileComponents.Heading { MobileComponents.Heading {
text: "Cloud credentials" text: "Cloud credentials"

View file

@ -6,71 +6,72 @@ import QtQuick.Layouts 1.1
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
Item {
id: preferencesWindow GridLayout {
signal accept signal accept
GridLayout { columns: 2
columns: 2 width: parent.width - MobileComponents.Units.gridUnit
anchors.fill: parent anchors {
anchors.margins: MobileComponents.Units.gridUnit fill: parent
margins: MobileComponents.Units.gridUnit / 2
}
MobileComponents.Heading { MobileComponents.Heading {
text: "Preferences" text: "Preferences"
Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2 Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
MobileComponents.Heading { MobileComponents.Heading {
text: "Subsurface GPS data webservice" text: "Subsurface GPS data webservice"
level: 3 level: 3
Layout.topMargin: MobileComponents.Units.largeSpacing Layout.topMargin: MobileComponents.Units.largeSpacing
Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2 Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
MobileComponents.Label { MobileComponents.Label {
text: "Distance threshold (meters)" text: "Distance threshold (meters)"
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
TextField { TextField {
id: distanceThreshold id: distanceThreshold
text: manager.distanceThreshold text: manager.distanceThreshold
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Time threshold (minutes)" text: "Time threshold (minutes)"
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
TextField { TextField {
id: timeThreshold id: timeThreshold
text: manager.timeThreshold text: manager.timeThreshold
Layout.fillWidth: true Layout.fillWidth: true
} }
Item { width: MobileComponents.Units.gridUnit; height: width } Item { width: MobileComponents.Units.gridUnit; height: width }
Item { Item {
height: saveButton.height height: saveButton.height
width: saveButton.width width: saveButton.width
Button { Button {
id: saveButton id: saveButton
text: "Save" text: "Save"
anchors.centerIn: parent anchors.centerIn: parent
onClicked: { onClicked: {
manager.distanceThreshold = distanceThreshold.text manager.distanceThreshold = distanceThreshold.text
manager.timeThreshold = timeThreshold.text manager.timeThreshold = timeThreshold.text
manager.savePreferences() manager.savePreferences()
stackView.pop() stackView.pop()
}
} }
} }
}
Item { Item {
Layout.fillHeight: true Layout.fillHeight: true
}
} }
} }