Commit 83544ce1 authored by Volker Krause's avatar Volker Krause

Port timeline delegates away from QtQuick layouts

This is far from ideal, but with little hope of getting QTBUG-81707 fixed,
that seems to be our only option.

This fixes most of the layouting glitches and the corresponding binding
loops in the timeline view, similar changes will be needed on a few other
pages too.
parent 70821b3b
......@@ -39,36 +39,38 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18n("From: %1", reservationFor.departureBusStop.name)
color: Kirigami.Theme.textColor
Layout.fillWidth: true
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.departureBusStop
controller: root.controller
isRangeBegin: true
Layout.fillWidth: true
width: topLayout.width
}
Kirigami.Separator {
Layout.fillWidth: true
width: topLayout.width
}
QQC2.Label {
text: i18n("To: %1", reservationFor.arrivalBusStop.name)
color: Kirigami.Theme.textColor
Layout.fillWidth: true
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.arrivalBusStop
controller: root.controller
isRangeEnd: true
Layout.fillWidth: true
width: topLayout.width
}
RowLayout {
Layout.fillWidth: true
Row {
width: topLayout.width
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18n("Arrival time: %1", Localizer.formatDateTime(reservationFor, "arrivalTime"))
color: Kirigami.Theme.textColor
......
......@@ -33,8 +33,9 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: reservation.pickupLocation.name
......@@ -44,7 +45,7 @@ App.TimelineDelegate {
place: reservation.pickupLocation
controller: root.controller
isRangeBegin: true
Layout.fillWidth: true
width: topLayout.width
visible: root.rangeType != TimelineElement.RangeEnd
}
QQC2.Label {
......@@ -58,7 +59,7 @@ App.TimelineDelegate {
App.PlaceDelegate {
place: reservation.dropoffLocation
isRangeEnd: true
Layout.fillWidth: true
width: topLayout.width
visible: root.rangeType != TimelineElement.RangeBegin
controller: root.controller
}
......
......@@ -37,8 +37,9 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: reservationFor.location.name
......@@ -48,7 +49,7 @@ App.TimelineDelegate {
controller: root.controller
isRangeBegin: root.rangeType == TimelineElement.RangeBegin
isRangeEnd: root.rangeType == TimelineElement.RangeEnd
Layout.fillWidth: true
width: topLayout.width
}
QQC2.Label {
text: i18n("Start time: %1", Localizer.formatDateTime(reservationFor, "startDate"))
......
......@@ -57,8 +57,9 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18nc("flight departure, %1 is airport, %2 is time", "Departure from %1: %2",
......@@ -66,13 +67,13 @@ App.TimelineDelegate {
Localizer.formatTime(reservationFor, "departureTime") + " ")
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.departureAirport
controller: root.controller
isRangeBegin: true
Layout.fillWidth: true
width: topLayout.width
}
QQC2.Label {
text: i18n("Terminal: %1 Gate: %2 Seat: %3",
......@@ -82,7 +83,7 @@ App.TimelineDelegate {
}
Kirigami.Separator {
Layout.fillWidth: true
width: topLayout.width
}
QQC2.Label {
......@@ -91,13 +92,13 @@ App.TimelineDelegate {
Localizer.formatDateTime(reservationFor, "arrivalTime") + " ")
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.arrivalAirport
controller: root.controller
isRangeEnd: true
Layout.fillWidth: true
width: topLayout.width
}
}
......
......@@ -24,13 +24,14 @@ App.TimelineDelegate {
Layout.fillWidth: true
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
App.PlaceDelegate {
place: reservationFor
controller: root.controller
Layout.fillWidth: true
width: topLayout.width
isRangeBegin: root.rangeType == TimelineElement.RangeBegin
isRangeEnd: root.rangeType == TimelineElement.RangeEnd
}
......
......@@ -46,11 +46,12 @@ Kirigami.AbstractCard {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
Layout.fillWidth: true
width: topLayout.width
text: locationInfo.drivingSide == KItinerary.KnowledgeDb.DrivingSide.Right ?
i18n("People are driving on the right side.") :
i18n("People are driving on the wrong side.")
......@@ -60,21 +61,21 @@ Kirigami.AbstractCard {
}
QQC2.Label {
Layout.fillWidth: true
width: topLayout.width
text: i18n("No compatible power sockets: %1", locationInfo.powerSocketTypes)
color: Kirigami.Theme.negativeTextColor
visible: locationInfo.powerPlugCompatibility == LocationInformation.Incompatible
wrapMode: Text.WordWrap
}
QQC2.Label {
Layout.fillWidth: true
width: topLayout.width
text: i18n("Some incompatible power sockets: %1", locationInfo.powerSocketTypes)
color: Kirigami.Theme.neutralTextColor
visible: locationInfo.powerPlugCompatibility == LocationInformation.PartiallyCompatible && locationInfo.powerSocketTypes != ""
wrapMode: Text.WordWrap
}
QQC2.Label {
Layout.fillWidth: true
width: topLayout.width
text: i18n("Some incompatible power plugs: %1", locationInfo.powerPlugTypes)
color: Kirigami.Theme.neutralTextColor
visible: locationInfo.powerPlugCompatibility == LocationInformation.PartiallyCompatible && locationInfo.powerPlugTypes != ""
......@@ -82,7 +83,7 @@ Kirigami.AbstractCard {
}
QQC2.Label {
Layout.fillWidth: true
width: topLayout.width
text: i18n("Timezone change: %1 (%2)", locationInfo.timeZoneName, Localizer.formatDuration(locationInfo.timeZoneOffsetDelta))
color: Kirigami.Theme.neutralTextColor
visible: locationInfo.timeZoneDiffers
......
......@@ -46,7 +46,7 @@ Item {
anchors.left: root.left
}
RowLayout {
Row {
id: buttonLayout
anchors.right: root.right
y: Math.max(0, label.implicitHeight - buttonLayout.implicitHeight)
......
......@@ -29,13 +29,14 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
App.PlaceDelegate {
place: reservationFor
controller: root.controller
Layout.fillWidth: true
width: topLayout.width
}
}
......
......@@ -30,13 +30,14 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
App.PlaceDelegate {
place: touristAttraction
controller: root.controller
Layout.fillWidth: true
width: topLayout.width
}
}
......
......@@ -40,8 +40,9 @@ App.TimelineDelegate {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18n("Departure from %1 on platform %2",
......@@ -50,19 +51,19 @@ App.TimelineDelegate {
reservationFor.departurePlatform ? reservationFor.departurePlatform : "-")
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.departureStation
isRangeBegin: true
Layout.fillWidth: true
width: topLayout.width
controller: root.controller
}
// TODO reserved seat
Kirigami.Separator {
Layout.fillWidth: true
width: topLayout.width
}
QQC2.Label {
text: i18n("Arrival at %1 on platform %2",
......@@ -71,10 +72,11 @@ App.TimelineDelegate {
reservationFor.arrivalPlatform ? reservationFor.arrivalPlatform : "-")
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
width: topLayout.width
}
RowLayout {
Layout.fillWidth: true
Row {
width: topLayout.width
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18n("Arrival time: %1", Localizer.formatDateTime(reservationFor, "arrivalTime"))
color: Kirigami.Theme.textColor
......@@ -90,7 +92,7 @@ App.TimelineDelegate {
App.PlaceDelegate {
place: reservationFor.arrivalStation
isRangeEnd: true
Layout.fillWidth: true
width: topLayout.width
controller: root.controller
}
}
......
......@@ -58,18 +58,20 @@ Kirigami.AbstractCard {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
ListView {
delegate: App.JourneySectionDelegate{}
model: (transfer.state == Transfer.Selected && journeyDetailsExpanded) ? transfer.journey.sections : 0
implicitHeight: contentHeight
Layout.fillWidth: true
width: topLayout.width
boundsBehavior: Flickable.StopAtBounds
}
App.JourneySummaryDelegate {
journey: transfer.journey
visible: transfer.state == Transfer.Selected && !journeyDetailsExpanded
Layout.fillWidth: true
}
QQC2.Button {
text: i18n("Select...")
......@@ -77,6 +79,7 @@ Kirigami.AbstractCard {
onClicked: applicationWindow().pageStack.push(detailsComponent);
}
RowLayout {
width: topLayout.width
visible: transfer.state == Transfer.Pending || transfer.state == Transfer.Searching
QQC2.BusyIndicator {
running: visible
......
......@@ -58,8 +58,9 @@ Kirigami.AbstractCard {
}
}
contentItem: ColumnLayout {
contentItem: Column {
id: contentLayout
spacing: Kirigami.Units.smallSpacing
visible: root.rangeType != TimelineElement.RangeEnd
QQC2.Label {
......@@ -98,6 +99,7 @@ Kirigami.AbstractCard {
}
color: modelData.powerPlugCompatibility == LocationInformation.PartiallyCompatible ? Kirigami.Theme.neutralTextColor : Kirigami.Theme.negativeTextColor
wrapMode: Text.WordWrap
width: contentLayout.width
}
}
......
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