From 7d4fae1cbbf7fd457fc0a42e5e0ca7d0fc302714 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 11:54:28 +0700 Subject: [PATCH 01/13] Add a FeatureUtils function to create a map extent from a given layer feature --- src/core/utils/featureutils.cpp | 33 +++++++++++++++++++++++++++++++++ src/core/utils/featureutils.h | 10 ++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/core/utils/featureutils.cpp b/src/core/utils/featureutils.cpp index 318d9e111f..597775def5 100644 --- a/src/core/utils/featureutils.cpp +++ b/src/core/utils/featureutils.cpp @@ -15,6 +15,7 @@ ***************************************************************************/ #include "featureutils.h" +#include "qgsquickmapsettings.h" #include #include @@ -50,3 +51,35 @@ QString FeatureUtils::displayName( QgsVectorLayer *layer, const QgsFeature &feat return name; } + +QgsRectangle FeatureUtils::extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature ) +{ + if ( mapSettings && layer && layer->geometryType() != Qgis::GeometryType::Unknown && layer->geometryType() != Qgis::GeometryType::Null ) + { + QgsCoordinateTransform transf( layer->crs(), mapSettings->destinationCrs(), mapSettings->mapSettings().transformContext() ); + QgsGeometry geom( feature.geometry() ); + if ( !geom.isNull() ) + { + geom.transform( transf ); + + QgsRectangle extent; + if ( geom.type() == Qgis::GeometryType::Point ) + { + QgsVector delta = QgsPointXY( geom.asPoint() ) - mapSettings->extent().center(); + extent = mapSettings->extent(); + extent.setXMinimum( extent.xMinimum() + delta.x() ); + extent.setXMaximum( extent.xMaximum() + delta.x() ); + extent.setYMinimum( extent.yMinimum() + delta.y() ); + extent.setYMaximum( extent.yMaximum() + delta.y() ); + } + else + { + QgsRectangle featureExtent = geom.boundingBox(); + extent = featureExtent.buffered( std::max( featureExtent.width(), featureExtent.height() ) ); + } + return extent; + } + } + + return QgsRectangle(); +} diff --git a/src/core/utils/featureutils.h b/src/core/utils/featureutils.h index ad326e0333..7bc62cfef6 100644 --- a/src/core/utils/featureutils.h +++ b/src/core/utils/featureutils.h @@ -23,6 +23,7 @@ #include class QgsVectorLayer; +class QgsQuickMapSettings; class QFIELD_CORE_EXPORT FeatureUtils : public QObject { @@ -38,6 +39,15 @@ class QFIELD_CORE_EXPORT FeatureUtils : public QObject * \param feature the feature to be named */ static Q_INVOKABLE QString displayName( QgsVectorLayer *layer, const QgsFeature &feature ); + + /** + * Returns the map extent encompassig a given feature + * \param mapSettings the map settings used to determine the CRS + * \param layer the vector layer containing the feature + * \param feature the feature from which the geometry will be used + * \returns a QgsRectangle extent + */ + static Q_INVOKABLE QgsRectangle extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature ); }; #endif // FEATUREUTILS_H From cb7f0863dc39656b026cda1876cfcdc0604c01ee Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 11:55:17 +0700 Subject: [PATCH 02/13] Rework the relation editor widget to allow for clicks on child to pan/zoom canvas to that child feature --- images/images.qrc | 2 + .../nodpi/ic_baseline-list_alt-24px.svg | 60 ------------ .../qfield/nodpi/ic_edit_attributes_white.svg | 73 -------------- .../relationeditors/relation_editor.qml | 96 ++++++++++++------- 4 files changed, 62 insertions(+), 169 deletions(-) delete mode 100644 images/themes/qfield/nodpi/ic_baseline-list_alt-24px.svg delete mode 100644 images/themes/qfield/nodpi/ic_edit_attributes_white.svg diff --git a/images/images.qrc b/images/images.qrc index 4cf1e472d8..64740a5b50 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -408,6 +408,7 @@ themes/qfield/xhdpi/ic_info_white_18dp.png themes/qfield/xxhdpi/ic_info_white_18dp.png themes/qfield/xxxhdpi/ic_info_white_18dp.png + themes/qfield/nodpi/ic_baseline-list_alt-24dp.svg themes/qfield/hdpi/ic_baseline-list_alt-24px.png themes/qfield/mdpi/ic_baseline-list_alt-24px.png themes/qfield/xhdpi/ic_baseline-list_alt-24px.png @@ -418,6 +419,7 @@ themes/qfield/mdpi/ic_edit_geometry_white.png themes/qfield/xhdpi/ic_edit_geometry_white.png themes/qfield/xxhdpi/ic_edit_geometry_white.png + themes/qfield/nodpi/ic_edit_attributes_white-24dp.svg themes/qfield/hdpi/ic_edit_attributes_white.png themes/qfield/xxxhdpi/ic_edit_attributes_white.png themes/qfield/mdpi/ic_edit_attributes_white.png diff --git a/images/themes/qfield/nodpi/ic_baseline-list_alt-24px.svg b/images/themes/qfield/nodpi/ic_baseline-list_alt-24px.svg deleted file mode 100644 index e42320fc71..0000000000 --- a/images/themes/qfield/nodpi/ic_baseline-list_alt-24px.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - diff --git a/images/themes/qfield/nodpi/ic_edit_attributes_white.svg b/images/themes/qfield/nodpi/ic_edit_attributes_white.svg deleted file mode 100644 index ed0e504faf..0000000000 --- a/images/themes/qfield/nodpi/ic_edit_attributes_white.svg +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - A - diff --git a/src/qml/editorwidgets/relationeditors/relation_editor.qml b/src/qml/editorwidgets/relationeditors/relation_editor.qml index e4d671a277..82104f3889 100644 --- a/src/qml/editorwidgets/relationeditors/relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/relation_editor.qml @@ -59,7 +59,6 @@ EditorWidgetBase { border.width: 1 clip: true - //the list ListView { id: referencingFeatureListView model: relationEditorModel @@ -86,7 +85,6 @@ EditorWidgetBase { } } - //the add entry "last row" Item { id: addEntry anchors.bottom: parent.bottom @@ -153,7 +151,6 @@ EditorWidgetBase { } } - //list components Component { id: referencingFeatureDelegate @@ -164,52 +161,77 @@ EditorWidgetBase { focus: true - height: Math.max( itemHeight, featureText.height ) + height: Math.max(itemHeight, featureText.height) - Text { - id: featureText - anchors { leftMargin: 10; left: parent.left; right: deleteButtonRow.left; verticalCenter: parent.verticalCenter } - font: Theme.defaultFont - color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor - text: { text: nmRelationId ? model.nmDisplayString : model.displayString } - } - - MouseArea { + Row { + id: itemRow anchors.fill: parent + anchors.rightMargin: 10 + anchors.leftMargin: 10 + height: listitem.height + + Text { + id: featureText + anchors.verticalCenter: parent.verticalCenter + width: parent.width - viewButton.width - deleteButton.width + font: Theme.defaultFont + color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor + elide: Text.ElideRight + text: nmRelationId ? model.nmDisplayString : model.displayString + + MouseArea { + anchors.fill: parent + + onClicked: { + if (relationEditorModel.relation.referencingLayer !== undefined) { + locatorHighlightItem.geometryWrapper.qgsGeometry = nmRelationId ? model.nmReferencingFeature.geometry : model.referencingFeature.geometry + locatorHighlightItem.geometryWrapper.crs = relationEditorModel.relation.referencingLayer.crs + mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, + relationEditorModel.relation.referencingLayer, + nmRelationId ? model.nmReferencingFeature : model.referencingFeature) + } + } + } + } + + QfToolButton { + id: viewButton + width: 40 + height: 40 - onClicked: { + round: false + iconSource: isEnabled ? Theme.getThemeVectorIcon('ic_edit_attributes_white-24dp') : Theme.getThemeVectorIcon('ic_baseline-list_alt-24dp') + iconColor: Theme.mainTextColor + bgcolor: 'transparent' + + onClicked: { embeddedPopup.state = isEnabled ? 'Edit' : 'ReadOnly' embeddedPopup.currentLayer = nmRelationId ? relationEditorModel.nmRelation.referencedLayer : relationEditorModel.relation.referencingLayer embeddedPopup.linkedRelation = relationEditorModel.relation embeddedPopup.linkedParentFeature = relationEditorModel.feature embeddedPopup.feature = nmRelationId ? model.nmReferencedFeature : model.referencingFeature embeddedPopup.open() + } } - } - - Row - { - id: deleteButtonRow - anchors { top: parent.top; right: parent.right; rightMargin: 10 } - height: listitem.height QfToolButton { - id: deleteButton - width: parent.height - height: parent.height - visible: isEnabled && isButtonEnabled('DeleteChildFeature') + id: deleteButton + visible: isEnabled && isButtonEnabled('DeleteChildFeature') + width: visible ? 40 : 0 + height: 40 - round: false - iconSource: Theme.getThemeIcon( 'ic_delete_forever_white_24dp' ) - bgcolor: nmRelationId ? 'blue' : Theme.errorColor + round: false + iconSource: Theme.getThemeIcon( 'ic_delete_forever_white_24dp' ) + iconColor: Theme.mainTextColor + bgcolor: 'transparent' - onClicked: { - deleteDialog.referencingFeatureId = model.referencingFeature.id - deleteDialog.referencingFeatureDisplayMessage = model.displayString - deleteDialog.nmReferencedFeatureId = nmRelationId ? model.model.nmReferencedFeature.id : '' - deleteDialog.nmReferencedFeatureDisplayMessage = nmRelationId ? model.nmDisplayString : '' - deleteDialog.visible = true - } + onClicked: { + deleteDialog.referencingFeatureId = model.referencingFeature.id + deleteDialog.referencingFeatureDisplayMessage = model.displayString + deleteDialog.nmReferencedFeatureId = nmRelationId ? model.model.nmReferencedFeature.id : '' + deleteDialog.nmReferencedFeatureDisplayMessage = nmRelationId ? model.nmDisplayString : '' + deleteDialog.visible = true + } } } @@ -224,7 +246,6 @@ EditorWidgetBase { } } - //the delete entry stuff Dialog { id: deleteDialog parent: mainWindow.contentItem @@ -240,6 +261,9 @@ EditorWidgetBase { visible: false modal: true z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature forms + x: ( mainWindow.width - width ) / 2 + y: ( mainWindow.height - height ) / 2 + font: Theme.defaultFont title: nmRelationId From d9ee87b7bb5e540f7cb5b1fce39a5dac67968be7 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 11:55:49 +0700 Subject: [PATCH 03/13] Rename some icon SVGs for better consistency --- .../nodpi/ic_baseline-list_alt-24dp.svg | 60 +++++++++++++++ .../nodpi/ic_edit_attributes_white-24dp.svg | 73 +++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 images/themes/qfield/nodpi/ic_baseline-list_alt-24dp.svg create mode 100644 images/themes/qfield/nodpi/ic_edit_attributes_white-24dp.svg diff --git a/images/themes/qfield/nodpi/ic_baseline-list_alt-24dp.svg b/images/themes/qfield/nodpi/ic_baseline-list_alt-24dp.svg new file mode 100644 index 0000000000..e42320fc71 --- /dev/null +++ b/images/themes/qfield/nodpi/ic_baseline-list_alt-24dp.svg @@ -0,0 +1,60 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/images/themes/qfield/nodpi/ic_edit_attributes_white-24dp.svg b/images/themes/qfield/nodpi/ic_edit_attributes_white-24dp.svg new file mode 100644 index 0000000000..ed0e504faf --- /dev/null +++ b/images/themes/qfield/nodpi/ic_edit_attributes_white-24dp.svg @@ -0,0 +1,73 @@ + + + + + + image/svg+xml + + + + + + + + + + A + From 8bad01b2c016bae6e4f12e01ccb03fb412fe1970 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 14:20:40 +0700 Subject: [PATCH 04/13] Move the geometry highlighter to sit on top of other highlighters, improve default colors --- src/qml/GeometryRenderer.qml | 4 ++-- src/qml/qgismobileapp.qml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qml/GeometryRenderer.qml b/src/qml/GeometryRenderer.qml index 28f2beabe9..f193d3be85 100644 --- a/src/qml/GeometryRenderer.qml +++ b/src/qml/GeometryRenderer.qml @@ -9,9 +9,9 @@ Item { property MapSettings mapSettings property alias geometryWrapper: geometryWrapper property double lineWidth: 3.5 - property color color: "yellow" + property color color: "#55ff0000" property double pointSize: 20 - property color borderColor: "blue" + property color borderColor: "#ff0000" property double borderSize: 2 QgsGeometryWrapper { diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index ce1f278ee6..b64c2a1c04 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -724,11 +724,6 @@ ApplicationWindow { } } - /* Locator Highlight */ - GeometryHighlighter { - id: locatorHighlightItem - } - /* Highlight the currently selected item on the feature list */ FeatureListSelectionHighlight { id: featureListHighlight @@ -763,6 +758,11 @@ ApplicationWindow { width: 5 } + /* Highlight features identified by locator or relation editor widgets */ + GeometryHighlighter { + id: locatorHighlightItem + } + MapToScreen { id: mapToScreenTranslateX mapSettings: mapCanvas.mapSettings From af23e3f385a0902988222f5f5f7de2f548e2e39d Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 14:24:15 +0700 Subject: [PATCH 05/13] Improve FeatureUtils::extent() buffer value, use new function in the feature list extent controller --- src/core/featurelistextentcontroller.cpp | 24 ++++-------------------- src/core/utils/featureutils.cpp | 2 +- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/core/featurelistextentcontroller.cpp b/src/core/featurelistextentcontroller.cpp index 04492d6a1e..ca23f4c2c7 100644 --- a/src/core/featurelistextentcontroller.cpp +++ b/src/core/featurelistextentcontroller.cpp @@ -14,6 +14,7 @@ ***************************************************************************/ #include "featurelistextentcontroller.h" +#include "featureutils.h" #include #include @@ -54,26 +55,9 @@ void FeatureListExtentController::zoomToSelected( bool skipIfIntersects ) const if ( layer && layer->geometryType() != Qgis::GeometryType::Unknown && layer->geometryType() != Qgis::GeometryType::Null ) { - QgsCoordinateTransform transf( layer->crs(), mMapSettings->destinationCrs(), mMapSettings->mapSettings().transformContext() ); - QgsGeometry geom( feat.geometry() ); - if ( !geom.isNull() ) - { - geom.transform( transf ); - - if ( geom.type() == Qgis::GeometryType::Point ) - { - if ( !skipIfIntersects || !mMapSettings->extent().intersects( geom.boundingBox() ) ) - mMapSettings->setCenter( QgsPoint( geom.asPoint() ) ); - } - else - { - QgsRectangle featureExtent = geom.boundingBox(); - QgsRectangle bufferedExtent = featureExtent.buffered( std::max( featureExtent.width(), featureExtent.height() ) ); - - if ( !skipIfIntersects || !mMapSettings->extent().intersects( bufferedExtent ) ) - mMapSettings->setExtent( bufferedExtent ); - } - } + QgsRectangle extent = FeatureUtils::extent( mMapSettings, layer, feat ); + if ( !skipIfIntersects || !mMapSettings->extent().intersects( extent ) ) + mMapSettings->setExtent( extent ); } } } diff --git a/src/core/utils/featureutils.cpp b/src/core/utils/featureutils.cpp index 597775def5..a16920835a 100644 --- a/src/core/utils/featureutils.cpp +++ b/src/core/utils/featureutils.cpp @@ -75,7 +75,7 @@ QgsRectangle FeatureUtils::extent( QgsQuickMapSettings *mapSettings, QgsVectorLa else { QgsRectangle featureExtent = geom.boundingBox(); - extent = featureExtent.buffered( std::max( featureExtent.width(), featureExtent.height() ) ); + extent = featureExtent.buffered( std::max( featureExtent.width(), featureExtent.height() ) / 4.0 ); } return extent; } From 4ab16342da4283b23e7a670b7e4a72b247c2c5f1 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 14:38:40 +0700 Subject: [PATCH 06/13] Make the geometry highlighter more effective by using opacity animation --- src/qml/GeometryHighlighter.qml | 37 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/qml/GeometryHighlighter.qml b/src/qml/GeometryHighlighter.qml index 83637a3e0a..8107d380a8 100644 --- a/src/qml/GeometryHighlighter.qml +++ b/src/qml/GeometryHighlighter.qml @@ -4,14 +4,31 @@ import org.qfield 1.0 Item { id: geometryHighlighter + property alias geometryWrapper: geometryRenderer.geometryWrapper property int duration: 3000 - Connections { - target: geometryRenderer.geometryWrapper + SequentialAnimation { + id: timer + running: false + loops: 3 + alwaysRunToEnd: true - function onQgsGeometryChanged() { - timer.restart() + OpacityAnimator { + target: geometryHighlighter; + from: 1; + to: 0; + duration: 500 + } + OpacityAnimator { + target: geometryHighlighter; + from: 0; + to: 1; + duration: 500 + } + + onFinished: { + geometryHighlighter.geometryWrapper.clear() } } @@ -20,11 +37,11 @@ Item { mapSettings: mapCanvas.mapSettings } - Timer { - id: timer - interval: geometryHighlighter.duration - running: false - repeat: false - onTriggered: geometryHighlighter.geometryWrapper.clear() + Connections { + target: geometryRenderer.geometryWrapper + + function onQgsGeometryChanged() { + timer.restart() + } } } From ffce89c1d06bca04ee2f7befd4160ce47039d674 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 14:57:53 +0700 Subject: [PATCH 07/13] Add ripple effect in relation editor widget to improve UX --- .../relationeditors/relation_editor.qml | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/qml/editorwidgets/relationeditors/relation_editor.qml b/src/qml/editorwidgets/relationeditors/relation_editor.qml index 82104f3889..b3019f5755 100644 --- a/src/qml/editorwidgets/relationeditors/relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/relation_editor.qml @@ -1,6 +1,8 @@ import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Layouts 1.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Controls.Material.impl 2.14 import org.qfield 1.0 import org.qgis 1.0 @@ -163,6 +165,31 @@ EditorWidgetBase { height: Math.max(itemHeight, featureText.height) + Ripple { + clip: true + width: parent.width + height: parent.height + pressed: mouseArea.pressed + anchor: listitem + active: mouseArea.pressed + color: Material.rippleColor + } + + MouseArea { + id: mouseArea + anchors.fill: parent + + onClicked: { + if (relationEditorModel.relation.referencingLayer !== undefined) { + locatorHighlightItem.geometryWrapper.qgsGeometry = nmRelationId ? model.nmReferencingFeature.geometry : model.referencingFeature.geometry + locatorHighlightItem.geometryWrapper.crs = relationEditorModel.relation.referencingLayer.crs + mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, + relationEditorModel.relation.referencingLayer, + nmRelationId ? model.nmReferencingFeature : model.referencingFeature) + } + } + } + Row { id: itemRow anchors.fill: parent @@ -178,20 +205,6 @@ EditorWidgetBase { color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor elide: Text.ElideRight text: nmRelationId ? model.nmDisplayString : model.displayString - - MouseArea { - anchors.fill: parent - - onClicked: { - if (relationEditorModel.relation.referencingLayer !== undefined) { - locatorHighlightItem.geometryWrapper.qgsGeometry = nmRelationId ? model.nmReferencingFeature.geometry : model.referencingFeature.geometry - locatorHighlightItem.geometryWrapper.crs = relationEditorModel.relation.referencingLayer.crs - mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, - relationEditorModel.relation.referencingLayer, - nmRelationId ? model.nmReferencingFeature : model.referencingFeature) - } - } - } } QfToolButton { From 1b246b86fc1a7fc5d03ae94552e407bf40826a4f Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 15:39:46 +0700 Subject: [PATCH 08/13] Add same ripple effect in the search bar --- src/qml/LocatorItem.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/qml/LocatorItem.qml b/src/qml/LocatorItem.qml index a5e7d98eb8..92fa04ddcd 100644 --- a/src/qml/LocatorItem.qml +++ b/src/qml/LocatorItem.qml @@ -1,5 +1,7 @@ import QtQuick 2.14 import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Controls.Material.impl 2.14 import org.qgis 1.0 import org.qfield 1.0 @@ -272,6 +274,16 @@ Item { color: isFilterName ? Theme.mainColor : isGroup ? Theme.controlBorderColor : "transparent" opacity: 0.95 + Ripple { + clip: true + width: parent.width + height: parent.height + pressed: mouseArea.pressed + anchor: delegateRect + active: mouseArea.pressed + color: Material.rippleColor + } + Text { id: textCell text: isFilterName ? model.ResultFilterName : model.Text.trim() @@ -322,6 +334,7 @@ Item { } MouseArea { + id: mouseArea anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom From 2de11df59dbb0ac4a2eb737017a99f97691b634b Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 23 Jun 2023 16:41:28 +0700 Subject: [PATCH 09/13] Implement click-to-zoom/pan UI/UX for the ordered relation editor widget --- .../ordered_relation_editor.qml | 145 ++++++++++-------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml index de07965f1d..8821c4a26e 100644 --- a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml @@ -2,6 +2,8 @@ import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQml.Models 2.14 import QtQuick.Layouts 1.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Controls.Material.impl 2.14 import org.qfield 1.0 import org.qgis 1.0 @@ -23,7 +25,7 @@ EditorWidgetBase { Rectangle { anchors.fill: parent color: "transparent" - border.color: 'lightgray' + border.color: Theme.controlBorderColor border.width: 1 } @@ -62,8 +64,6 @@ EditorWidgetBase { highlightRangeMode: ListView.ApplyRange } - - //the add entry "last row" Item { id: addEntry anchors.top: listView.bottom @@ -74,12 +74,12 @@ EditorWidgetBase { Rectangle{ anchors.fill: parent - color: 'lightgrey' + color: Theme.controlBorderColor visible: isEnabled Text { visible: isEnabled - color: 'grey' + color: Theme.secondaryTextColor text: isEnabled && !constraintsHardValid ? qsTr( 'Ensure contraints') : '' anchors { leftMargin: 10; left: parent.left; right: addButtonRow.left; verticalCenter: parent.verticalCenter } font.bold: true @@ -134,7 +134,6 @@ EditorWidgetBase { } } - Component { id: dragDelegate @@ -165,18 +164,18 @@ EditorWidgetBase { orderedRelationModel.moveItems(indexFrom, indexTo) } else if (listView.currentIndex !== dragArea.DelegateModel.itemsIndex) { listView.currentIndex = dragArea.DelegateModel.itemsIndex - orderedRelationModel.onViewCurrentFeatureChanged(listView.currentIndex) + orderedRelationModel.viewCurrentFeatureChanged(listView.currentIndex) } } onClicked: { - embeddedPopup.state = isEnabled ? 'Edit' : 'ReadOnly' - embeddedPopup.currentLayer = orderedRelationModel.relation.referencingLayer - embeddedPopup.linkedRelation = orderedRelationModel.relation - embeddedPopup.linkedRelationOrderingField = orderedRelationModel.orderingField - embeddedPopup.linkedParentFeature = orderedRelationModel.feature - embeddedPopup.feature = model.referencingFeature - embeddedPopup.open() + if (orderedRelationModel.relation.referencingLayer !== undefined) { + locatorHighlightItem.geometryWrapper.qgsGeometry = nmRelationId ? model.nmReferencingFeature.geometry : model.referencingFeature.geometry + locatorHighlightItem.geometryWrapper.crs = orderedRelationModel.relation.referencingLayer.crs + mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, + orderedRelationModel.relation.referencingLayer, + nmRelationId ? model.nmReferencingFeature : model.referencingFeature) + } } Rectangle { @@ -188,8 +187,17 @@ EditorWidgetBase { width: dragArea.width height: row.implicitHeight + 4 - color: dragArea.held ? Theme.lightGray : "transparent" - Behavior on color { ColorAnimation { duration: 100 } } + Ripple { + clip: true + width: parent.width + height: parent.height + pressed: dragArea.pressed + anchor: content + active: dragArea.pressed + color: Material.rippleColor + } + + color: "transparent" radius: 2 Drag.active: dragArea.held @@ -228,7 +236,7 @@ EditorWidgetBase { Text { id: featureText font: Theme.defaultFont - color: !isEnabled ? 'grey' : 'black' + color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor text: Description || model.displayString verticalAlignment: Text.AlignVCenter padding: 4 @@ -236,30 +244,44 @@ EditorWidgetBase { width: parent.width - 8 - (featureImage.visible ? featureImage.width : 0) - - (moveDownButton.visible ? moveDownButton.width : 0) - - (moveUpButton.visible ? moveUpButton.width : 0) - - (deleteButton.visible ? deleteButton.width : 0) + - viewButton.width + - moveDownButton.width + - moveUpButton.width + - deleteButton.width } - ToolButton { + QfToolButton { + id: viewButton + width: 40 + height: 40 + + round: false + iconSource: isEnabled ? Theme.getThemeVectorIcon('ic_edit_attributes_white-24dp') : Theme.getThemeVectorIcon('ic_baseline-list_alt-24dp') + iconColor: Theme.mainTextColor + bgcolor: 'transparent' + + onClicked: { + embeddedPopup.state = isEnabled ? 'Edit' : 'ReadOnly' + embeddedPopup.currentLayer = orderedRelationModel.relation.referencingLayer + embeddedPopup.linkedRelation = orderedRelationModel.relation + embeddedPopup.linkedRelationOrderingField = orderedRelationModel.orderingField + embeddedPopup.linkedParentFeature = orderedRelationModel.feature + embeddedPopup.feature = model.referencingFeature + embeddedPopup.open() + } + } + + QfToolButton { id: moveDownButton - width: itemHeight - height: itemHeight visible: isEnabled + width: visible ? 40 : 0 + height: 40 opacity: (index === listView.count - 1) ? 0.3 : 1 - contentItem: Rectangle { - anchors.fill: parent - color: 'transparent' - Image { - anchors.fill: parent - anchors.margins: 8 - fillMode: Image.PreserveAspectFit - horizontalAlignment: Image.AlignHCenter - verticalAlignment: Image.AlignVCenter - source: Theme.getThemeVectorIcon( 'ic_chevron_down' ) - } - } + round: false + iconSource: Theme.getThemeVectorIcon( 'ic_chevron_down' ) + iconColor: Theme.mainTextColor + bgcolor: 'transparent' onClicked: { if (index === listView.count - 1) { @@ -273,25 +295,17 @@ EditorWidgetBase { } } - ToolButton { + QfToolButton { id: moveUpButton - width: itemHeight - height: itemHeight visible: isEnabled + width: visible ? 40 : 0 + height: 40 opacity: (index === 0) ? 0.3 : 1 - contentItem: Rectangle { - anchors.fill: parent - color: 'transparent' - Image { - anchors.fill: parent - anchors.margins: 8 - fillMode: Image.PreserveAspectFit - horizontalAlignment: Image.AlignHCenter - verticalAlignment: Image.AlignVCenter - source: Theme.getThemeVectorIcon( 'ic_chevron_up' ) - } - } + round: false + iconSource: Theme.getThemeVectorIcon( 'ic_chevron_up' ) + iconColor: Theme.mainTextColor + bgcolor: 'transparent' onClicked: { if (index === 0) { @@ -305,24 +319,16 @@ EditorWidgetBase { } } - ToolButton { + QfToolButton { id: deleteButton - width: itemHeight - height: itemHeight visible: isEnabled + width: visible ? 40 : 0 + height: 40 - contentItem: Rectangle { - anchors.fill: parent - color: nmRelationId ? 'blue' : Theme.errorColor - Image { - anchors.fill: parent - anchors.margins: 8 - fillMode: Image.PreserveAspectFit - horizontalAlignment: Image.AlignHCenter - verticalAlignment: Image.AlignVCenter - source: Theme.getThemeIcon( 'ic_delete_forever_white_24dp' ) - } - } + round: false + iconSource: Theme.getThemeIcon( 'ic_delete_forever_white_24dp' ) + iconColor: Theme.mainTextColor + bgcolor: 'transparent' onClicked: { deleteDialog.referencingFeatureId = model.referencingFeature.id @@ -338,7 +344,7 @@ EditorWidgetBase { id: bottomLine anchors.bottom: parent.bottom height: 1 - color: 'lightGray' + color: Theme.controlBorderColor width: parent.width } } @@ -368,15 +374,18 @@ EditorWidgetBase { property int referencingFeatureId property string referencingFeatureDisplayMessage - property string referencingLayerName: relationEditorModel.relation.referencingLayer ? relationEditorModel.relation.referencingLayer.name : '' + property string referencingLayerName: orderedRelationModel.relation.referencingLayer ? orderedRelationModel.relation.referencingLayer.name : '' property int nmReferencedFeatureId property string nmReferencedFeatureDisplayMessage - property string nmReferencedLayerName: relationEditorModel.nmRelation.referencedLayer ? relationEditorModel.nmRelation.referencedLayer.name : '' + property string nmReferencedLayerName: orderedRelationModel.nmRelation.referencedLayer ? orderedRelationModel.nmRelation.referencedLayer.name : '' property string nmReferencingLayerName visible: false modal: true z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature forms + x: ( mainWindow.width - width ) / 2 + y: ( mainWindow.height - height ) / 2 + font: Theme.defaultFont title: nmRelationId From 92b8381c24a78da2cefd192740c99cfd84a9c791 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 24 Jun 2023 11:55:46 +0700 Subject: [PATCH 10/13] Massive UX improvement: pan/zoom to feature within *visible* area of the map canvas --- src/core/featurelistextentcontroller.cpp | 2 +- src/core/featurelistextentcontroller.h | 4 +++ src/core/orderedrelationmodel.cpp | 2 +- src/core/orderedrelationmodel.h | 4 +-- src/core/utils/featureutils.cpp | 30 ++++++++++++++----- src/core/utils/featureutils.h | 4 ++- src/qml/FeatureListForm.qml | 1 + .../ordered_relation_editor.qml | 6 ++-- .../relationeditors/relation_editor.qml | 4 ++- 9 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/core/featurelistextentcontroller.cpp b/src/core/featurelistextentcontroller.cpp index ca23f4c2c7..766ffbf5a8 100644 --- a/src/core/featurelistextentcontroller.cpp +++ b/src/core/featurelistextentcontroller.cpp @@ -55,7 +55,7 @@ void FeatureListExtentController::zoomToSelected( bool skipIfIntersects ) const if ( layer && layer->geometryType() != Qgis::GeometryType::Unknown && layer->geometryType() != Qgis::GeometryType::Null ) { - QgsRectangle extent = FeatureUtils::extent( mMapSettings, layer, feat ); + QgsRectangle extent = FeatureUtils::extent( mMapSettings, layer, feat, mFeatureForm ? mFeatureForm->x() : 0.0, mFeatureForm ? mFeatureForm->y() : 0.0 ); if ( !skipIfIntersects || !mMapSettings->extent().intersects( extent ) ) mMapSettings->setExtent( extent ); } diff --git a/src/core/featurelistextentcontroller.h b/src/core/featurelistextentcontroller.h index 6d799f7d7d..23d648e687 100644 --- a/src/core/featurelistextentcontroller.h +++ b/src/core/featurelistextentcontroller.h @@ -21,6 +21,7 @@ #include "qgsquickmapsettings.h" #include +#include class FeatureListExtentController : public QObject { @@ -30,6 +31,7 @@ class FeatureListExtentController : public QObject Q_PROPERTY( FeatureListModelSelection *selection MEMBER mSelection NOTIFY selectionChanged ) Q_PROPERTY( bool autoZoom MEMBER mAutoZoom NOTIFY autoZoomChanged ) Q_PROPERTY( QgsQuickMapSettings *mapSettings MEMBER mMapSettings NOTIFY mapSettingsChanged ) + Q_PROPERTY( QQuickItem *featureForm MEMBER mFeatureForm NOTIFY featureFormChanged ) public: explicit FeatureListExtentController( QObject *parent = nullptr ); @@ -54,6 +56,7 @@ class FeatureListExtentController : public QObject void selectionChanged(); void modelChanged(); void mapSettingsChanged(); + void featureFormChanged(); void featureFormStateRequested(); private slots: @@ -64,6 +67,7 @@ class FeatureListExtentController : public QObject MultiFeatureListModel *mModel = nullptr; FeatureListModelSelection *mSelection = nullptr; QgsQuickMapSettings *mMapSettings = nullptr; + QQuickItem *mFeatureForm = nullptr; bool mAutoZoom = false; }; diff --git a/src/core/orderedrelationmodel.cpp b/src/core/orderedrelationmodel.cpp index f44ca5d825..8311d14a14 100644 --- a/src/core/orderedrelationmodel.cpp +++ b/src/core/orderedrelationmodel.cpp @@ -117,7 +117,7 @@ QVariant OrderedRelationModel::data( const QModelIndex &index, int role ) const return ReferencingFeatureListModel::data( index, role ); } -void OrderedRelationModel::onViewCurrentFeatureChanged( int index ) +void OrderedRelationModel::triggerViewCurrentFeatureChange( int index ) { if ( index < 0 || index >= rowCount( QModelIndex() ) ) return; diff --git a/src/core/orderedrelationmodel.h b/src/core/orderedrelationmodel.h index 8aef1637bd..444832c5ca 100644 --- a/src/core/orderedrelationmodel.h +++ b/src/core/orderedrelationmodel.h @@ -52,6 +52,7 @@ class OrderedRelationModel : public ReferencingFeatureListModel QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; Q_INVOKABLE bool moveItems( const int fromIdx, const int toIdx ); QHash roleNames() const override; + Q_INVOKABLE void triggerViewCurrentFeatureChange( int index ); signals: void orderingFieldChanged(); @@ -60,9 +61,6 @@ class OrderedRelationModel : public ReferencingFeatureListModel void currentFeatureChanged( QgsFeature feature ); void failedReorder(); - private slots: - void onViewCurrentFeatureChanged( int index ); - private: bool beforeDeleteFeature( QgsVectorLayer *referencingLayer, QgsFeatureId referencingFeatureId ) override; void sortEntries() override; diff --git a/src/core/utils/featureutils.cpp b/src/core/utils/featureutils.cpp index a16920835a..4396b691bd 100644 --- a/src/core/utils/featureutils.cpp +++ b/src/core/utils/featureutils.cpp @@ -52,7 +52,7 @@ QString FeatureUtils::displayName( QgsVectorLayer *layer, const QgsFeature &feat return name; } -QgsRectangle FeatureUtils::extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature ) +QgsRectangle FeatureUtils::extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature, const double &rightEdge, const double &bottomEdge ) { if ( mapSettings && layer && layer->geometryType() != Qgis::GeometryType::Unknown && layer->geometryType() != Qgis::GeometryType::Null ) { @@ -63,20 +63,34 @@ QgsRectangle FeatureUtils::extent( QgsQuickMapSettings *mapSettings, QgsVectorLa geom.transform( transf ); QgsRectangle extent; + const double rightPercentage = rightEdge / mapSettings->outputSize().width(); + const double bottomPercentage = bottomEdge / mapSettings->outputSize().height(); if ( geom.type() == Qgis::GeometryType::Point ) { - QgsVector delta = QgsPointXY( geom.asPoint() ) - mapSettings->extent().center(); extent = mapSettings->extent(); - extent.setXMinimum( extent.xMinimum() + delta.x() ); - extent.setXMaximum( extent.xMaximum() + delta.x() ); - extent.setYMinimum( extent.yMinimum() + delta.y() ); - extent.setYMaximum( extent.yMaximum() + delta.y() ); + QgsVector delta = QgsPointXY( geom.asPoint() ) - extent.center(); + const double deltaX = delta.x() + ( rightEdge > 0.0 ? mapSettings->mapUnitsPerPoint() * mapSettings->outputSize().width() * ( 0.5 - rightPercentage / 2.0 ) : 0.0 ); + const double deltaY = delta.y() - ( bottomEdge > 0.0 ? mapSettings->mapUnitsPerPoint() * mapSettings->outputSize().height() * ( 0.5 - ( 1.0 - bottomPercentage ) / 2.0 ) : 0.0 ); + extent.setXMinimum( extent.xMinimum() + deltaX ); + extent.setXMaximum( extent.xMaximum() + deltaX ); + extent.setYMinimum( extent.yMinimum() + deltaY ); + extent.setYMaximum( extent.yMaximum() + deltaY ); } else { - QgsRectangle featureExtent = geom.boundingBox(); - extent = featureExtent.buffered( std::max( featureExtent.width(), featureExtent.height() ) / 4.0 ); + extent = geom.boundingBox(); + extent = extent.buffered( std::max( extent.width(), extent.height() ) / 6.0 ); + + if ( rightEdge > 0.0 ) + { + extent.setXMaximum( extent.xMaximum() + ( extent.xMaximum() - extent.xMinimum() ) * rightPercentage ); + } + if ( bottomEdge > 0.0 ) + { + extent.setYMinimum( extent.yMinimum() - ( extent.yMaximum() - extent.yMinimum() ) * bottomPercentage * 2 ); + } } + return extent; } } diff --git a/src/core/utils/featureutils.h b/src/core/utils/featureutils.h index 7bc62cfef6..0ed39f1d70 100644 --- a/src/core/utils/featureutils.h +++ b/src/core/utils/featureutils.h @@ -45,9 +45,11 @@ class QFIELD_CORE_EXPORT FeatureUtils : public QObject * \param mapSettings the map settings used to determine the CRS * \param layer the vector layer containing the feature * \param feature the feature from which the geometry will be used + * \param righeEdge provide a right edge beyond which the canvas is hidden and extent shouldn't overlap with + * \param bottomEdge provide a bottom edge beyond which the canvas is hidden and extent shouldn't overlap with * \returns a QgsRectangle extent */ - static Q_INVOKABLE QgsRectangle extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature ); + static Q_INVOKABLE QgsRectangle extent( QgsQuickMapSettings *mapSettings, QgsVectorLayer *layer, const QgsFeature &feature, const double &rightEdge = 0.0, const double &bottomEdge = 0.0 ); }; #endif // FEATUREUTILS_H diff --git a/src/qml/FeatureListForm.qml b/src/qml/FeatureListForm.qml index 5c54dde909..e5f2943d4c 100644 --- a/src/qml/FeatureListForm.qml +++ b/src/qml/FeatureListForm.qml @@ -391,6 +391,7 @@ Rectangle { model: globalFeaturesList.model selection: featureForm.selection mapSettings: featureForm.mapSettings + featureForm: featureForm onFeatureFormStateRequested: { featureForm.state = "FeatureForm" diff --git a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml index 8821c4a26e..6793dc89bc 100644 --- a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml @@ -164,7 +164,7 @@ EditorWidgetBase { orderedRelationModel.moveItems(indexFrom, indexTo) } else if (listView.currentIndex !== dragArea.DelegateModel.itemsIndex) { listView.currentIndex = dragArea.DelegateModel.itemsIndex - orderedRelationModel.viewCurrentFeatureChanged(listView.currentIndex) + orderedRelationModel.triggerViewCurrentFeatureChange(listView.currentIndex) } } @@ -174,7 +174,9 @@ EditorWidgetBase { locatorHighlightItem.geometryWrapper.crs = orderedRelationModel.relation.referencingLayer.crs mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, orderedRelationModel.relation.referencingLayer, - nmRelationId ? model.nmReferencingFeature : model.referencingFeature) + nmRelationId ? model.nmReferencingFeature : model.referencingFeature, + featureForm.x, + featureForm.y) } } diff --git a/src/qml/editorwidgets/relationeditors/relation_editor.qml b/src/qml/editorwidgets/relationeditors/relation_editor.qml index b3019f5755..98e420013e 100644 --- a/src/qml/editorwidgets/relationeditors/relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/relation_editor.qml @@ -185,7 +185,9 @@ EditorWidgetBase { locatorHighlightItem.geometryWrapper.crs = relationEditorModel.relation.referencingLayer.crs mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, relationEditorModel.relation.referencingLayer, - nmRelationId ? model.nmReferencingFeature : model.referencingFeature) + nmRelationId ? model.nmReferencingFeature : model.referencingFeature, + featureForm.x, + featureForm.y) } } } From 16fe7639e6355238a02debe50eac9af45b5aaeb7 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 24 Jun 2023 15:09:49 +0700 Subject: [PATCH 11/13] Implement zoom/pan to parent feature in the relation reference editor widget --- src/qml/editorwidgets/RelationReference.qml | 43 +++++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/src/qml/editorwidgets/RelationReference.qml b/src/qml/editorwidgets/RelationReference.qml index f023667f32..88baf0258f 100644 --- a/src/qml/editorwidgets/RelationReference.qml +++ b/src/qml/editorwidgets/RelationReference.qml @@ -40,7 +40,7 @@ EditorWidgetBase { RelationCombobox { id: relationReference featureListModel: listModel - anchors { left: parent.left; right: parent.right; rightMargin: showOpenFormButton ? viewButton.width : 0 } + anchors { left: parent.left; right: parent.right; rightMargin: viewButton.width + openFormButton.width + 4 } enabled: isEnabled useSearch: true allowAddFeature: config['AllowAddFeatures'] !== undefined && config['AllowAddFeatures'] === true @@ -52,7 +52,7 @@ EditorWidgetBase { id: viewButton enabled: showOpenFormButton && relationReference.currentKeyValue !== undefined && relationReference.currentKeyValue !== '' - anchors { right: parent.right; top: parent.top; } + anchors { right: openFormButton.left; top: parent.top; } width: enabled ? 48 : 0 height: 48 @@ -62,12 +62,39 @@ EditorWidgetBase { bgcolor: "transparent" onClicked: { - if ( relationReference.currentKeyValue !== undefined && relationReference.currentKeyValue !== '' ) { - relationReference.embeddedFeatureForm.state = isEnabled ? 'Edit' : 'ReadOnly' - relationReference.embeddedFeatureForm.currentLayer = listModel.currentLayer - relationReference.embeddedFeatureForm.feature = listModel.getFeatureFromKeyValue( relationReference.currentKeyValue ) - relationReference.embeddedFeatureForm.open() - } + if (listModel.currentLayer !== undefined) { + var feature = listModel.getFeatureFromKeyValue(relationReference.currentKeyValue) + locatorHighlightItem.geometryWrapper.qgsGeometry = feature.geometry + locatorHighlightItem.geometryWrapper.crs = listModel.currentLayer.crs + mapCanvas.mapSettings.extent = FeatureUtils.extent(mapCanvas.mapSettings, + listModel.currentLayer, + feature, + featureForm.x, + featureForm.y) + } + } + } + + QfToolButton { + id: openFormButton + + enabled: showOpenFormButton && relationReference.currentKeyValue !== undefined && relationReference.currentKeyValue !== '' + anchors { right: parent.right; top: parent.top; } + + width: enabled ? 48 : 0 + height: 48 + + iconSource: isEnabled ? Theme.getThemeVectorIcon('ic_edit_attributes_white-24dp') : Theme.getThemeVectorIcon('ic_baseline-list_alt-24dp') + iconColor: Theme.mainTextColor + bgcolor: "transparent" + + onClicked: { + if ( relationReference.currentKeyValue !== undefined && relationReference.currentKeyValue !== '' ) { + relationReference.embeddedFeatureForm.state = isEnabled ? 'Edit' : 'ReadOnly' + relationReference.embeddedFeatureForm.currentLayer = listModel.currentLayer + relationReference.embeddedFeatureForm.feature = listModel.getFeatureFromKeyValue(relationReference.currentKeyValue) + relationReference.embeddedFeatureForm.open() + } } } } From be294f977aa666abcb84dc867f2de4704cbebf1d Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 24 Jun 2023 15:31:05 +0700 Subject: [PATCH 12/13] Improve selected/highlghted feature styling --- src/core/qgssggeometry.cpp | 4 ++-- src/qml/FeatureListSelectionHighlight.qml | 1 - src/qml/GeometryRenderer.qml | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/qgssggeometry.cpp b/src/core/qgssggeometry.cpp index 6777b08001..89aa705334 100644 --- a/src/core/qgssggeometry.cpp +++ b/src/core/qgssggeometry.cpp @@ -75,7 +75,7 @@ QgsSGGeometry::QgsSGGeometry( const QgsGeometry &geom, const QColor &color, floa if ( pg.isMultipart() ) { QSGOpacityNode *on = new QSGOpacityNode; - on->setOpacity( 0.5 ); + on->setOpacity( 0.25 ); QgsGeometryPartIterator it = pg.parts(); while ( it.hasNext() ) @@ -105,7 +105,7 @@ QgsSGGeometry::QgsSGGeometry( const QgsGeometry &geom, const QColor &color, floa else { QSGOpacityNode *on = new QSGOpacityNode; - on->setOpacity( 0.5 ); + on->setOpacity( 0.25 ); QSGGeometryNode *geomNode = new QSGGeometryNode; QgsCurvePolygon *c = qgsgeometry_cast( pg.get() ); if ( !c ) diff --git a/src/qml/FeatureListSelectionHighlight.qml b/src/qml/FeatureListSelectionHighlight.qml index ce2ae778f3..e96bbb3f17 100644 --- a/src/qml/FeatureListSelectionHighlight.qml +++ b/src/qml/FeatureListSelectionHighlight.qml @@ -23,7 +23,6 @@ Repeater { visible: featureListSelectionHighlight.visible && ( !showSelectedOnly || model.featureSelected ) color: model.featureSelected ? featureListSelectionHighlight.selectedColor : selectionModel.model.selectedCount === 0 && selectionModel && model.index === selectionModel.focusedItem ? featureListSelectionHighlight.focusedColor : featureListSelectionHighlight.color - borderColor: "white" transform: Translate { x: featureListSelectionHighlight.translateX diff --git a/src/qml/GeometryRenderer.qml b/src/qml/GeometryRenderer.qml index f193d3be85..d7d93a65bb 100644 --- a/src/qml/GeometryRenderer.qml +++ b/src/qml/GeometryRenderer.qml @@ -9,10 +9,9 @@ Item { property MapSettings mapSettings property alias geometryWrapper: geometryWrapper property double lineWidth: 3.5 - property color color: "#55ff0000" + property color color: "#ff0000" property double pointSize: 20 - property color borderColor: "#ff0000" - property double borderSize: 2 + property double borderSize: 3 QgsGeometryWrapper { id: geometryWrapper @@ -70,12 +69,12 @@ Item { x: mapToScreenPosition.screenPoint.x - width/2 y: mapToScreenPosition.screenPoint.y - width/2 - color: geometryRenderer.color + color: Qt.hsla(geometryRenderer.color.hslHue, geometryRenderer.color.hslSaturation, geometryRenderer.color.hslLightness, 0.5) width: geometryRenderer.pointSize height: geometryRenderer.pointSize radius: geometryRenderer.pointSize / 2 - border.color: geometryRenderer.borderColor + border.color: geometryRenderer.color border.width: geometryRenderer.borderSize } } From c336a0fb2e3bb1618ad71da9f992ee9a2e7b2b9e Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 24 Jun 2023 15:33:20 +0700 Subject: [PATCH 13/13] Insure that focused item always sits on top of highlighted group of features --- src/qml/FeatureListSelectionHighlight.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/FeatureListSelectionHighlight.qml b/src/qml/FeatureListSelectionHighlight.qml index e96bbb3f17..d9d5bc332d 100644 --- a/src/qml/FeatureListSelectionHighlight.qml +++ b/src/qml/FeatureListSelectionHighlight.qml @@ -23,6 +23,7 @@ Repeater { visible: featureListSelectionHighlight.visible && ( !showSelectedOnly || model.featureSelected ) color: model.featureSelected ? featureListSelectionHighlight.selectedColor : selectionModel.model.selectedCount === 0 && selectionModel && model.index === selectionModel.focusedItem ? featureListSelectionHighlight.focusedColor : featureListSelectionHighlight.color + z: model.index === selectionModel.focusedItem ? 1 : 0 transform: Translate { x: featureListSelectionHighlight.translateX