From d299b1e0affdaac29e90ba6e78fbcf9168904cb4 Mon Sep 17 00:00:00 2001 From: DoinLakeFlyer Date: Mon, 10 Feb 2020 09:51:27 -0800 Subject: [PATCH] Fix sizing/scrolling --- src/FlightDisplay/PreFlightCheckList.qml | 103 +++++++++++++---------- 1 file changed, 58 insertions(+), 45 deletions(-) diff --git a/src/FlightDisplay/PreFlightCheckList.qml b/src/FlightDisplay/PreFlightCheckList.qml index 04b783a84..09fd86015 100644 --- a/src/FlightDisplay/PreFlightCheckList.qml +++ b/src/FlightDisplay/PreFlightCheckList.qml @@ -19,10 +19,12 @@ import QGroundControl.Vehicle 1.0 Rectangle { width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3 - height: mainColumn.height + ScreenTools.defaultFontPixelHeight + height: Math.min(availableHeight - (_verticalMargin * 2), mainColumn.height + ScreenTools.defaultFontPixelHeight) color: qgcPal.windowShade radius: 3 + property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2 + Loader { id: modelContainer source: "/checklists/DefaultChecklist.qml" @@ -94,56 +96,67 @@ Rectangle { onTriggered: _handleGroupPassedChanged(index, true /* passed */) } - Column { - id: mainColumn - width: 40 * ScreenTools.defaultFontPixelWidth - spacing: 0.8 * ScreenTools.defaultFontPixelWidth - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 0.6 * ScreenTools.defaultFontPixelWidth - anchors.leftMargin: 1.5 * ScreenTools.defaultFontPixelWidth - - function groupPassedChanged(index, passed) { - if (passed) { - delayedGroupPassed.index = index - delayedGroupPassed.restart() - } else { - _handleGroupPassedChanged(index, passed) + QGCFlickable { + id: flickable + anchors.topMargin: _verticalMargin + anchors.bottomMargin: _verticalMargin + anchors.leftMargin: _horizontalMargin + anchors.rightMargin: _horizontalMargin + anchors.fill: parent + flickableDirection: Flickable.VerticalFlick + contentWidth: mainColumn.width + contentHeight: mainColumn.height + + property real _horizontalMargin: 1.5 * ScreenTools.defaultFontPixelWidth + property real _verticalMargin: 0.6 * ScreenTools.defaultFontPixelWidth + + Column { + id: mainColumn + width: 40 * ScreenTools.defaultFontPixelWidth + spacing: 0.8 * ScreenTools.defaultFontPixelWidth + + function groupPassedChanged(index, passed) { + if (passed) { + delayedGroupPassed.index = index + delayedGroupPassed.restart() + } else { + _handleGroupPassedChanged(index, passed) + } } - } - // Header/title of checklist - Item { - width: parent.width - height: 1.75 * ScreenTools.defaultFontPixelHeight + // Header/title of checklist + Item { + width: parent.width + height: 1.75 * ScreenTools.defaultFontPixelHeight - QGCLabel { - text: qsTr("Pre-Flight Checklist %1").arg(_passed ? qsTr("(passed)") : "") - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - font.pointSize: ScreenTools.mediumFontPointSize - } - QGCButton { - width: 1.2 * ScreenTools.defaultFontPixelHeight - height: 1.2 * ScreenTools.defaultFontPixelHeight - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)") - - onClicked: checkListRepeater.model.reset() - - QGCColoredImage { - source: "/qmlimages/MapSyncBlack.svg" - color: qgcPal.buttonText - anchors.fill: parent + QGCLabel { + text: qsTr("Pre-Flight Checklist %1").arg(_passed ? qsTr("(passed)") : "") + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + font.pointSize: ScreenTools.mediumFontPointSize + } + QGCButton { + width: 1.2 * ScreenTools.defaultFontPixelHeight + height: 1.2 * ScreenTools.defaultFontPixelHeight + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)") + + onClicked: checkListRepeater.model.reset() + + QGCColoredImage { + source: "/qmlimages/MapSyncBlack.svg" + color: qgcPal.buttonText + anchors.fill: parent + } } } - } - // All check list items - Repeater { - id: checkListRepeater - model: modelContainer.item.model + // All check list items + Repeater { + id: checkListRepeater + model: modelContainer.item.model + } } } } -- 2.22.0