use a ScrollView for the main flickable

It managed the styled scroll indicator and the
behavior.

Signed-off-by: Marco Martin <notmart@gmail.com>
This commit is contained in:
Marco Martin 2015-11-30 01:12:47 +01:00 committed by Sebastian Kügler
parent 09bf7fabcf
commit cf9476c74e

View file

@ -28,138 +28,141 @@ MobileComponents.Page {
qmlProfile.update() qmlProfile.update()
} }
Flickable { ScrollView {
id: flick
anchors.fill: parent anchors.fill: parent
contentHeight: content.height Flickable {
clip: true id: flick
Item { anchors.fill: parent
id: content contentHeight: content.height
width: flick.width clip: true
height: childrenRect.height + MobileComponents.Units.smallSpacing * 2 Item {
id: content
width: flick.width
height: childrenRect.height + MobileComponents.Units.smallSpacing * 2
ColumnLayout { ColumnLayout {
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
margins: MobileComponents.Units.smallSpacing margins: MobileComponents.Units.smallSpacing
}
spacing: MobileComponents.Units.smallSpacing
GridLayout {
id: editorDetails
width: parent.width
columns: 2
MobileComponents.Heading {
Layout.columnSpan: 2
text: "Dive " + number + " (" + date + ")"
} }
spacing: MobileComponents.Units.smallSpacing
Item {
Layout.columnSpan: 2 GridLayout {
Layout.fillWidth: true id: editorDetails
Layout.preferredHeight: qmlProfile.visible ? qmlProfile.height : profileHideButton.height width: parent.width
QMLProfile { columns: 2
id: qmlProfile
height: MobileComponents.Units.gridUnit * 25 MobileComponents.Heading {
anchors { Layout.columnSpan: 2
top: parent.top text: "Dive " + number + " (" + date + ")"
left: parent.left
right: parent.right
}
//Rectangle { color: "green"; opacity: 0.4; anchors.fill: parent } // used for debugging the dive profile sizing, will be removed later
} }
Button {
id: profileHideButton Item {
anchors { Layout.columnSpan: 2
right: parent.right Layout.fillWidth: true
top: parent.top Layout.preferredHeight: qmlProfile.visible ? qmlProfile.height : profileHideButton.height
QMLProfile {
id: qmlProfile
height: MobileComponents.Units.gridUnit * 25
anchors {
top: parent.top
left: parent.left
right: parent.right
}
//Rectangle { color: "green"; opacity: 0.4; anchors.fill: parent } // used for debugging the dive profile sizing, will be removed later
} }
text: "Hide Dive Profile" Button {
onClicked: { id: profileHideButton
qmlProfile.visible = !qmlProfile.visible anchors {
if (qmlProfile.visible) { right: parent.right
text = "Hide Dive Profile" top: parent.top
} else { }
text = "Show Dive Profile" text: "Hide Dive Profile"
onClicked: {
qmlProfile.visible = !qmlProfile.visible
if (qmlProfile.visible) {
text = "Hide Dive Profile"
} else {
text = "Show Dive Profile"
}
} }
} }
} }
} MobileComponents.Label {
MobileComponents.Label { text: "Location:"
text: "Location:" }
} TextField {
TextField { id: txtLocation; text: location;
id: txtLocation; text: location; Layout.fillWidth: true
Layout.fillWidth: true }
}
MobileComponents.Label { MobileComponents.Label {
text: "Air Temp:" text: "Air Temp:"
} }
TextField { TextField {
id: txtAirTemp id: txtAirTemp
text: airtemp text: airtemp
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Water Temp:" text: "Water Temp:"
} }
TextField { TextField {
id: txtWaterTemp id: txtWaterTemp
text: watertemp text: watertemp
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Suit:" text: "Suit:"
} }
TextField { TextField {
id: txtSuit id: txtSuit
text: suit text: suit
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Buddy:" text: "Buddy:"
} }
TextField { TextField {
id: txtBuddy id: txtBuddy
text: buddy text: buddy
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Dive Master:" text: "Dive Master:"
} }
TextField { TextField {
id: txtDiveMaster id: txtDiveMaster
text: divemaster text: divemaster
Layout.fillWidth: true Layout.fillWidth: true
} }
MobileComponents.Label { MobileComponents.Label {
text: "Notes:" text: "Notes:"
}
TextEdit{
id: txtNotes
text: notes
focus: true
Layout.fillWidth: true
Layout.fillHeight: true
selectByMouse: true
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
}
} }
TextEdit{ Item {
id: txtNotes height: MobileComponents.Units.gridUnit * 3
text: notes width: height // just to make sure the spacer doesn't produce scrollbars, but also isn't null
focus: true
Layout.fillWidth: true
Layout.fillHeight: true
selectByMouse: true
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
} }
} }
Item {
height: MobileComponents.Units.gridUnit * 3
width: height // just to make sure the spacer doesn't produce scrollbars, but also isn't null
}
} }
} }
} }