From 60fbc49261f886d950a48f05e7509b6d636cce15 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Wed, 21 Feb 2018 16:53:07 -0500 Subject: [PATCH] Create a "Dead Mouse Area" control to eat mouse events underneath desired area. This is to prevent mouse events from leaking through controls underneath the area. Replace original "NoMouseThroughRectangle" as this is more versatile. Prevent mouse through events from leaking underneath the Fly View tool strip. --- qgroundcontrol.qrc | 96 +++++++++---------- src/FlightDisplay/GuidedActionConfirm.qml | 6 +- src/FlightDisplay/GuidedActionList.qml | 6 +- src/FlightDisplay/MultiVehicleList.qml | 6 +- src/PlanView/PlanToolBar.qml | 7 +- src/QmlControls/DeadMouseArea.qml | 10 ++ src/QmlControls/NoMouseThroughRectangle.qml | 14 --- .../QGroundControl.Controls.qmldir | 14 +-- src/QmlControls/ToolStrip.qml | 4 + .../QMLControl/OfflineMap.qml | 8 +- src/ui/MainWindowInner.qml | 7 +- 11 files changed, 91 insertions(+), 87 deletions(-) create mode 100644 src/QmlControls/DeadMouseArea.qml delete mode 100644 src/QmlControls/NoMouseThroughRectangle.qml diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index f9679f4f47..ce7371c750 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -15,21 +15,29 @@ src/ui/toolbar/JoystickIndicator.qml + src/PlanView/CorridorScanEditor.qml + src/PlanView/CameraCalc.qml + src/PlanView/CorridorScanMapVisual.qml + src/QmlControls/EditPositionDialog.qml + src/QmlControls/FileButton.qml + src/MissionManager/QGCMapCircleVisuals.qml + src/MissionManager/QGCMapPolylineVisuals.qml + src/PlanView/StructureScanMapVisual.qml src/AnalyzeView/AnalyzeView.qml src/ui/AppSettings.qml src/ui/preferences/BluetoothSettings.qml - src/PlanView/CorridorScanEditor.qml + src/FlightMap/Widgets/CameraPageWidget.qml src/ViewWidgets/CustomCommandWidget.qml src/ui/preferences/DebugWindow.qml src/AutoPilotPlugins/Common/ESP8266Component.qml src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml - src/AutoPilotPlugins/Common/SyslinkComponent.qml src/VehicleSetup/FirmwareUpgrade.qml src/FlightDisplay/FlightDisplayViewDummy.qml src/FlightDisplay/FlightDisplayViewUVC.qml + src/PlanView/FWLandingPatternEditor.qml src/ui/preferences/GeneralSettings.qml src/AnalyzeView/GeoTagPage.qml - src/AnalyzeView/MavlinkConsolePage.qml + src/FlightMap/Widgets/HealthPageWidget.qml src/VehicleSetup/JoystickConfig.qml src/ui/preferences/LinkSettings.qml src/AnalyzeView/LogDownloadPage.qml @@ -37,24 +45,26 @@ src/ui/MainWindowHybrid.qml src/ui/MainWindowInner.qml src/ui/MainWindowNative.qml + src/AnalyzeView/MavlinkConsolePage.qml src/ui/preferences/MavlinkSettings.qml - src/PlanView/PlanView.qml + src/PlanView/MissionSettingsEditor.qml src/ui/preferences/MockLink.qml src/ui/preferences/MockLinkSettings.qml src/AutoPilotPlugins/Common/MotorComponent.qml src/QtLocationPlugin/QMLControl/OfflineMap.qml + src/PlanView/PlanView.qml src/VehicleSetup/PX4FlowSensor.qml + src/FlightMap/Widgets/QGCInstrumentWidget.qml + src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml src/AnalyzeView/AnalyzePage.qml src/QmlControls/AppMessages.qml - src/PlanView/CameraCalc.qml src/PlanView/CameraSection.qml src/QmlControls/ClickableColor.qml - src/PlanView/CorridorScanMapVisual.qml + src/QmlControls/DeadMouseArea.qml src/QmlControls/DropButton.qml - src/QmlControls/EditPositionDialog.qml + src/QmlControls/DropPanel.qml src/QmlControls/ExclusiveGroupItem.qml src/QmlControls/FactSliderPanel.qml - src/QmlControls/FileButton.qml src/QmlControls/FlightModeDropdown.qml src/QmlControls/FlightModeMenu.qml src/PlanView/FWLandingPatternMapVisual.qml @@ -71,7 +81,6 @@ src/PlanView/MissionItemStatus.qml src/QmlControls/ModeSwitchDisplay.qml src/QmlControls/MultiRotorMotorDisplay.qml - src/QmlControls/NoMouseThroughRectangle.qml src/QmlControls/OfflineMapButton.qml src/QmlControls/PageView.qml src/QmlControls/ParameterEditor.qml @@ -89,9 +98,7 @@ src/QmlControls/QGCLabel.qml src/QmlControls/QGCListView.qml src/QmlControls/QGCMapLabel.qml - src/MissionManager/QGCMapCircleVisuals.qml src/MissionManager/QGCMapPolygonVisuals.qml - src/MissionManager/QGCMapPolylineVisuals.qml src/QmlControls/QGCMouseArea.qml src/QmlControls/QGCMovableItem.qml src/QmlControls/QGCPipable.qml @@ -116,13 +123,11 @@ src/ui/toolbar/SignalStrength.qml src/PlanView/SimpleItemMapVisual.qml src/QmlControls/SliderSwitch.qml - src/PlanView/StructureScanMapVisual.qml src/QmlControls/SubMenuButton.qml src/PlanView/SurveyMapVisual.qml + src/QmlControls/ToolStrip.qml src/QmlControls/VehicleRotationCal.qml src/QmlControls/VehicleSummaryRow.qml - src/QmlControls/ToolStrip.qml - src/QmlControls/DropPanel.qml src/ViewWidgets/ViewWidget.qml src/FactSystem/FactControls/FactBitmask.qml src/FactSystem/FactControls/FactCheckBox.qml @@ -137,9 +142,9 @@ src/FlightDisplay/FlightDisplayViewMap.qml src/FlightDisplay/FlightDisplayViewVideo.qml src/FlightDisplay/FlightDisplayViewWidgets.qml - src/FlightDisplay/GuidedActionsController.qml src/FlightDisplay/GuidedActionConfirm.qml src/FlightDisplay/GuidedActionList.qml + src/FlightDisplay/GuidedActionsController.qml src/FlightDisplay/GuidedAltitudeSlider.qml src/FlightDisplay/MultiVehicleList.qml src/FlightDisplay/qmldir @@ -148,9 +153,9 @@ src/FlightMap/Widgets/CenterMapDropPanel.qml src/FlightMap/Widgets/CompassRing.qml src/FlightMap/MapItems/CustomMapItems.qml - src/FlightMap/Widgets/MapFitFunctions.qml src/FlightMap/FlightMap.qml src/FlightMap/Widgets/InstrumentSwipeView.qml + src/FlightMap/Widgets/MapFitFunctions.qml src/FlightMap/MapScale.qml src/FlightMap/MapItems/MissionItemIndicator.qml src/FlightMap/MapItems/MissionItemIndicatorDrag.qml @@ -162,8 +167,6 @@ src/FlightMap/Widgets/QGCAttitudeHUD.qml src/FlightMap/Widgets/QGCAttitudeWidget.qml src/FlightMap/Widgets/QGCCompassWidget.qml - src/FlightMap/Widgets/QGCInstrumentWidget.qml - src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml src/FlightMap/Widgets/QGCPitchIndicator.qml src/FlightMap/QGCVideoBackground.qml src/FlightMap/qmldir @@ -178,57 +181,54 @@ src/PlanView/SimpleItemEditor.qml src/PlanView/StructureScanEditor.qml src/PlanView/SurveyItemEditor.qml - src/PlanView/FWLandingPatternEditor.qml - src/PlanView/MissionSettingsEditor.qml + src/AutoPilotPlugins/Common/SyslinkComponent.qml src/ui/preferences/TcpSettings.qml src/test.qml src/ui/preferences/UdpSettings.qml - src/VehicleSetup/VehicleSummary.qml - src/FlightDisplay/VirtualJoystick.qml - src/FlightMap/Widgets/CameraPageWidget.qml - src/FlightMap/Widgets/VideoPageWidget.qml src/FlightMap/Widgets/ValuePageWidget.qml - src/FlightMap/Widgets/HealthPageWidget.qml + src/VehicleSetup/VehicleSummary.qml src/FlightMap/Widgets/VibrationPageWidget.qml + src/FlightMap/Widgets/VideoPageWidget.qml + src/FlightDisplay/VirtualJoystick.qml + src/MissionManager/CameraCalc.FactMetaData.json + src/MissionManager/CameraSpec.FactMetaData.json + src/MissionManager/CorridorScan.SettingsGroup.json + src/QmlControls/EditPositionDialog.FactMetaData.json + src/MissionManager/QGCMapCircle.Facts.json + src/MissionManager/StructureScan.SettingsGroup.json + src/MissionManager/TransectStyle.SettingsGroup.json + src/Settings/App.SettingsGroup.json + src/Settings/AutoConnect.SettingsGroup.json + src/Settings/BrandImage.SettingsGroup.json + src/MissionManager/CameraSection.FactMetaData.json + src/Settings/FlightMap.SettingsGroup.json + src/MissionManager/FWLandingPattern.FactMetaData.json + src/Settings/Guided.SettingsGroup.json src/MissionManager/MavCmdInfoCommon.json src/MissionManager/MavCmdInfoFixedWing.json src/MissionManager/MavCmdInfoMultiRotor.json src/MissionManager/MavCmdInfoRover.json src/MissionManager/MavCmdInfoSub.json src/MissionManager/MavCmdInfoVTOL.json - src/Settings/App.SettingsGroup.json - src/Settings/AutoConnect.SettingsGroup.json - src/Settings/FlightMap.SettingsGroup.json - src/Settings/Guided.SettingsGroup.json - src/MissionManager/QGCMapCircle.Facts.json + src/MissionManager/MissionSettings.FactMetaData.json + src/MissionManager/RallyPoint.FactMetaData.json src/Settings/RTK.SettingsGroup.json - src/MissionManager/TransectStyle.SettingsGroup.json + src/MissionManager/SpeedSection.FactMetaData.json src/MissionManager/Survey.SettingsGroup.json - src/MissionManager/CorridorScan.SettingsGroup.json - src/MissionManager/StructureScan.SettingsGroup.json src/Settings/Units.SettingsGroup.json - src/Settings/Video.SettingsGroup.json - src/MissionManager/RallyPoint.FactMetaData.json - src/MissionManager/FWLandingPattern.FactMetaData.json src/comm/USBBoardInfo.json - src/MissionManager/CameraSection.FactMetaData.json - src/MissionManager/CameraCalc.FactMetaData.json - src/MissionManager/CameraSpec.FactMetaData.json - src/MissionManager/SpeedSection.FactMetaData.json - src/MissionManager/MissionSettings.FactMetaData.json - src/QmlControls/EditPositionDialog.FactMetaData.json - src/Vehicle/VehicleFact.json src/Vehicle/BatteryFact.json + src/Vehicle/ClockFact.json src/Vehicle/GPSFact.json src/Vehicle/GPSRTKFact.json - src/Vehicle/WindFact.json - src/Vehicle/VibrationFact.json - src/Vehicle/TemperatureFact.json src/Vehicle/SubmarineFact.json - src/Settings/BrandImage.SettingsGroup.json - src/Vehicle/ClockFact.json + src/Vehicle/TemperatureFact.json + src/Vehicle/VehicleFact.json + src/Vehicle/VibrationFact.json + src/Vehicle/WindFact.json + src/Settings/Video.SettingsGroup.json src/comm/APMArduCopterMockLink.params diff --git a/src/FlightDisplay/GuidedActionConfirm.qml b/src/FlightDisplay/GuidedActionConfirm.qml index 48c159fa2e..36aedb24b1 100644 --- a/src/FlightDisplay/GuidedActionConfirm.qml +++ b/src/FlightDisplay/GuidedActionConfirm.qml @@ -16,7 +16,7 @@ import QGroundControl.Controls 1.0 import QGroundControl.Palette 1.0 /// Guided actions confirmation dialog -NoMouseThroughRectangle { +Rectangle { id: _root border.color: qgcPal.alertBorder border.width: 1 @@ -48,6 +48,10 @@ NoMouseThroughRectangle { QGCPalette { id: qgcPal } + DeadMouseArea { + anchors.fill: parent + } + Column { id: confirmColumn anchors.margins: _margins diff --git a/src/FlightDisplay/GuidedActionList.qml b/src/FlightDisplay/GuidedActionList.qml index 4c002c3ce1..768c7d814f 100644 --- a/src/FlightDisplay/GuidedActionList.qml +++ b/src/FlightDisplay/GuidedActionList.qml @@ -17,7 +17,7 @@ import QGroundControl.Controls 1.0 import QGroundControl.Palette 1.0 /// Dialog showing list of available guided actions -NoMouseThroughRectangle { +Rectangle { id: _root width: actionColumn.width + (_margins * 4) height: actionColumn.height + (_margins * 4) @@ -35,6 +35,10 @@ NoMouseThroughRectangle { QGCPalette { id: qgcPal } + DeadMouseArea { + anchors.fill: parent + } + ColumnLayout { id: actionColumn anchors.margins: _root._margins diff --git a/src/FlightDisplay/MultiVehicleList.qml b/src/FlightDisplay/MultiVehicleList.qml index bc20e0d14d..4c62a4f1cd 100644 --- a/src/FlightDisplay/MultiVehicleList.qml +++ b/src/FlightDisplay/MultiVehicleList.qml @@ -28,7 +28,7 @@ Item { QGCPalette { id: qgcPal } - NoMouseThroughRectangle { + Rectangle { id: mvCommands anchors.left: parent.left anchors.right: parent.right @@ -37,6 +37,10 @@ Item { opacity: _rectOpacity radius: _margin + DeadMouseArea { + anchors.fill: parent + } + Column { id: mvCommandsColumn anchors.margins: _margin diff --git a/src/PlanView/PlanToolBar.qml b/src/PlanView/PlanToolBar.qml index d51f346d9c..754f3a3844 100644 --- a/src/PlanView/PlanToolBar.qml +++ b/src/PlanView/PlanToolBar.qml @@ -84,11 +84,8 @@ Rectangle { } //-- Eat mouse events, preventing them from reaching toolbar, which is underneath us. - MouseArea { - anchors.fill: parent - onWheel: { wheel.accepted = true; } - onPressed: { mouse.accepted = true; } - onReleased: { mouse.accepted = true; } + DeadMouseArea { + anchors.fill: parent } //-- The reason for this Row to be here is so the Logo (Home) button is in the same diff --git a/src/QmlControls/DeadMouseArea.qml b/src/QmlControls/DeadMouseArea.qml new file mode 100644 index 0000000000..39db1ec189 --- /dev/null +++ b/src/QmlControls/DeadMouseArea.qml @@ -0,0 +1,10 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 + +MouseArea { + preventStealing:true + hoverEnabled: true + onWheel: { wheel.accepted = true; } + onPressed: { mouse.accepted = true; } + onReleased: { mouse.accepted = true; } +} diff --git a/src/QmlControls/NoMouseThroughRectangle.qml b/src/QmlControls/NoMouseThroughRectangle.qml deleted file mode 100644 index 295f6e3c6d..0000000000 --- a/src/QmlControls/NoMouseThroughRectangle.qml +++ /dev/null @@ -1,14 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 - -/// This control is used to create a Rectangle control which does not allow mouse events to bleed through to the control -/// which is beneath it. -Rectangle { - MouseArea { - anchors.fill: parent - preventStealing: true - onWheel: { wheel.accepted = true; } - onPressed: { mouse.accepted = true; } - onReleased: { mouse.accepted = true; } - } -} diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index 02680ff52d..65b86d035b 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -5,6 +5,7 @@ AppMessages 1.0 AppMessages.qml CameraCalc 1.0 CameraCalc.qml CameraSection 1.0 CameraSection.qml ClickableColor 1.0 ClickableColor.qml +DeadMouseArea 1.0 DeadMouseArea.qml DropButton 1.0 DropButton.qml DropPanel 1.0 DropPanel.qml EditPositionDialog 1.0 EditPositionDialog.qml @@ -27,15 +28,11 @@ MissionItemMapVisual 1.0 MissionItemMapVisual.qml MissionItemStatus 1.0 MissionItemStatus.qml ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml MultiRotorMotorDisplay 1.0 MultiRotorMotorDisplay.qml -NoMouseThroughRectangle 1.0 NoMouseThroughRectangle.qml +OfflineMapButton 1.0 OfflineMapButton.qml PageView 1.0 PageView.qml ParameterEditor 1.0 ParameterEditor.qml ParameterEditorDialog 1.0 ParameterEditorDialog.qml PlanToolBar 1.0 PlanToolBar.qml -RallyPointEditorHeader 1.0 RallyPointEditorHeader.qml -RallyPointItemEditor 1.0 RallyPointItemEditor.qml -RallyPointMapVisuals 1.0 RallyPointMapVisuals.qml -RCChannelMonitor 1.0 RCChannelMonitor.qml QGCButton 1.0 QGCButton.qml QGCCheckBox 1.0 QGCCheckBox.qml QGCColoredImage 1.0 QGCColoredImage.qml @@ -45,8 +42,8 @@ QGCFlickable 1.0 QGCFlickable.qml QGCGroupBox 1.0 QGCGroupBox.qml QGCLabel 1.0 QGCLabel.qml QGCListView 1.0 QGCListView.qml -QGCMapLabel 1.0 QGCMapLabel.qml QGCMapCircleVisuals 1.0 QGCMapCircleVisuals.qml +QGCMapLabel 1.0 QGCMapLabel.qml QGCMapPolygonVisuals 1.0 QGCMapPolygonVisuals.qml QGCMapPolylineVisuals 1.0 QGCMapPolylineVisuals.qml QGCMouseArea 1.0 QGCMouseArea.qml @@ -62,6 +59,10 @@ QGCViewDialog 1.0 QGCViewDialog.qml QGCViewDialogContainer 1.0 QGCViewDialogContainer.qml QGCViewMessage 1.0 QGCViewMessage.qml QGCViewPanel 1.0 QGCViewPanel.qml +RallyPointEditorHeader 1.0 RallyPointEditorHeader.qml +RallyPointItemEditor 1.0 RallyPointItemEditor.qml +RallyPointMapVisuals 1.0 RallyPointMapVisuals.qml +RCChannelMonitor 1.0 RCChannelMonitor.qml RoundButton 1.0 RoundButton.qml SectionHeader 1.0 SectionHeader.qml SetupPage 1.0 SetupPage.qml @@ -74,4 +75,3 @@ ToolStrip 1.0 ToolStrip.qml VehicleRotationCal 1.0 VehicleRotationCal.qml VehicleSummaryRow 1.0 VehicleSummaryRow.qml ViewWidget 1.0 ViewWidget.qml -OfflineMapButton 1.0 OfflineMapButton.qml diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index 4d7d9aeebd..23cbfdda57 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -52,6 +52,10 @@ Rectangle { } } + DeadMouseArea { + anchors.fill: parent + } + Column { id: buttonStripColumn anchors.margins: ScreenTools.defaultFontPixelWidth / 2 diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index eec0d0b84e..187c12a2dc 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -654,11 +654,9 @@ QGCView { color: Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.85) radius: ScreenTools.defaultFontPixelWidth * 0.5 - MouseArea { - anchors.fill: parent - onWheel: { wheel.accepted = true; } - onPressed: { mouse.accepted = true; } - onReleased: { mouse.accepted = true; } + //-- Eat mouse events + DeadMouseArea { + anchors.fill: parent } QGCLabel { diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index a344f93699..e4b6069bda 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -296,13 +296,10 @@ Item { onVtolTransitionToMRFlight: flightView.guidedController.confirmAction(flightView.guidedController.actionVtolTransitionToMRFlight) //-- Entire tool bar area disable on cammand - MouseArea { + DeadMouseArea { id: toolbarBlocker - anchors.fill: parent enabled: false - onWheel: { wheel.accepted = true; } - onPressed: { mouse.accepted = true; } - onReleased: { mouse.accepted = true; } + anchors.fill: parent } } -- GitLab