diff --git a/src/FactSystem/FactControls/FactTextField.qml b/src/FactSystem/FactControls/FactTextField.qml index 3dd02aa68e4880ee82094a052485c91a8fe5cd51..58a7093609898675b3ced471dddbd437d0768162 100644 --- a/src/FactSystem/FactControls/FactTextField.qml +++ b/src/FactSystem/FactControls/FactTextField.qml @@ -26,6 +26,10 @@ QGCTextField { Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard onEditingFinished: { + if (ScreenTools.isMobile) { + // Toss focus on mobile after Done on virtual keyboard. Prevent strange interactions. + focus = false + } if (typeof qgcView !== 'undefined' && qgcView) { var errorString = fact.validate(text, false /* convertOnly */) if (errorString == "") { diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index ed30b1510b4d3cb5a138e9261702025b710ad21c..f10ead0431fd3f02c58221759c4a963772ec6cf5 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -85,6 +85,7 @@ FlightMap { title: qsTr("Fly") z: QGroundControl.zOrderWidgets buttonVisible: [ true, true, _showZoom, _showZoom ] + maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y // Massive reach across hack property bool _showZoom: !ScreenTools.isShortScreen diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index d8038782a083a1b6dd47c0f4160d18fed2a4192c..87d7e126870f6837b729af0cfb39bc7692ef1a72 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -777,6 +777,7 @@ QGCView { rotateImage: [ false, false, _syncDropDownController.syncInProgress, false, false, false, false ] buttonEnabled: [ true, true, !_syncDropDownController.syncInProgress, true, true, true, true ] buttonVisible: [ true, true, true, true, true, _showZoom, _showZoom ] + maxHeight: mapScale.y - toolStrip.y property bool _showZoom: !ScreenTools.isShortScreen @@ -839,6 +840,7 @@ QGCView { } MapScale { + id: mapScale anchors.margins: ScreenTools.defaultFontPixelHeight * (0.66) anchors.bottom: waypointValuesDisplay.visible ? waypointValuesDisplay.top : parent.bottom anchors.left: parent.left diff --git a/src/MissionEditor/MissionItemEditor.qml b/src/MissionEditor/MissionItemEditor.qml index 0ee2e90ac787b2848519d95735c0ad3bfa4797cf..156345685abacd2cd2ff97222ad9dc85a347f674 100644 --- a/src/MissionEditor/MissionItemEditor.qml +++ b/src/MissionEditor/MissionItemEditor.qml @@ -66,50 +66,57 @@ Rectangle { visible: missionItem.isCurrentItem && missionItem.sequenceNumber != 0 color: qgcPal.windowShade - MouseArea { - anchors.fill: parent - onClicked: hamburgerMenu.popup() + } - Menu { - id: hamburgerMenu + MouseArea { + // The MouseArea for the hamburger is larger than the hamburger image itself in order to provide a larger + // touch area on mobile + anchors.top: parent.top + anchors.bottom: editorLoader.top + anchors.leftMargin: -hamburger.anchors.rightMargin + anchors.left: hamburger.left + anchors.right: parent.right + onClicked: hamburgerMenu.popup() + + Menu { + id: hamburgerMenu + + MenuItem { + text: qsTr("Insert") + onTriggered: insert() + } - MenuItem { - text: qsTr("Insert") - onTriggered: insert() - } + MenuItem { + text: qsTr("Delete") + onTriggered: remove() + } - MenuItem { - text: qsTr("Delete") - onTriggered: remove() - } + MenuItem { + text: "Change command..." + onTriggered: commandPicker.clicked() + } - MenuItem { - text: "Change command..." - onTriggered: commandPicker.clicked() - } + MenuSeparator { + visible: missionItem.isSimpleItem + } - MenuSeparator { - visible: missionItem.isSimpleItem - } + MenuItem { + text: qsTr("Show all values") + checkable: true + checked: missionItem.isSimpleItem ? missionItem.rawEdit : false + visible: missionItem.isSimpleItem - MenuItem { - text: qsTr("Show all values") - checkable: true - checked: missionItem.isSimpleItem ? missionItem.rawEdit : false - visible: missionItem.isSimpleItem - - onTriggered: { - if (missionItem.rawEdit) { - if (missionItem.friendlyEditAllowed) { - missionItem.rawEdit = false - } else { - qgcView.showMessage(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"), StandardButton.Ok) - } + onTriggered: { + if (missionItem.rawEdit) { + if (missionItem.friendlyEditAllowed) { + missionItem.rawEdit = false } else { - missionItem.rawEdit = true + qgcView.showMessage(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"), StandardButton.Ok) } - checked = missionItem.rawEdit + } else { + missionItem.rawEdit = true } + checked = missionItem.rawEdit } } } diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index 699a82c646310ed90d534f551d74be528ab379b4..8b5497e905879ee1a466bde6267596e8899939cc 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -29,6 +29,13 @@ TextField { implicitHeight: ScreenTools.implicitTextFieldHeight + onEditingFinished: { + if (ScreenTools.isMobile) { + // Toss focus on mobile after Done on virtual keyboard. Prevent strange interactions. + focus = false + } + } + QGCLabel { id: unitsLabelWidthGenerator text: unitsLabel diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index 76331e1f5e2c8e6acd8b0bc01cd6ee90d2d77ba0..0df07900f9996c583ed29054e225714acffa6926 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -22,17 +22,55 @@ Rectangle { property string title: "Title" property alias model: repeater.model - property var showAlternateIcon - property var rotateImage - property var buttonEnabled - property var buttonVisible + property var showAlternateIcon ///< List of bool values, one for each button in strip - true: show alternate icon, false: show normal icon + property var rotateImage ///< List of bool values, one for each button in strip - true: animation rotation, false: static image + property var buttonEnabled ///< List of bool values, one for each button in strip - true: button enabled, false: button disabled + property var buttonVisible ///< List of bool values, one for each button in strip - true: button visible, false: button invisible + property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter signal clicked(int index, bool checked) readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth - readonly property bool _showOptionalElements: !ScreenTools.isShortScreen + + // All of the following values, connections and function are to support the ability to determine + // whether to show or hide the optional elements on the fly. + + property bool _showOptionalElements: true + property bool _needRecalc: true + + Component.onCompleted: recalcShowOptionalElements() + + onMaxHeightChanged: recalcShowOptionalElements() + + Connections { + target: ScreenTools + + onDefaultFontPixelWidthChanged: recalcShowOptionalElements() + onDefaultFontPixelHeightChanged: recalcShowOptionalElements() + } + + onHeightChanged: { + if (_needRecalc) { + _needRecalc = false + if (maxHeight && height > maxHeight) { + _showOptionalElements = false + } + } + } + + function recalcShowOptionalElements() { + if (_showOptionalElements) { + if (maxHeight && height > maxHeight) { + _showOptionalElements = false + } + } else { + _needRecalc = true + _showOptionalElements = true + } + + } QGCPalette { id: qgcPal } ExclusiveGroup { id: dropButtonsExclusiveGroup }