Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ set(MM_HDRS
workspacesmodel.h
workspacesproxymodel.h
mmstyle.h
mmtypeutils.h
)

if (NOT WIN32)
Expand Down
12 changes: 6 additions & 6 deletions app/inpututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ QgsGeometry InputUtils::transformGeometryToMapWithLayer( const QgsGeometry &geom
{
if ( !sourceLayer || !sourceLayer->isValid() || !targetSettings )
{
return QgsGeometry();
return {};
}

return transformGeometry( geometry, sourceLayer->crs(), targetSettings->destinationCrs(), targetSettings->transformContext() );
Expand Down Expand Up @@ -818,7 +818,7 @@ QgsPoint InputUtils::point( double x, double y, double z, double m )

QgsGeometry InputUtils::emptyGeometry()
{
return QgsGeometry();
return {};
}

QgsFeature InputUtils::emptyFeature()
Expand Down Expand Up @@ -1670,12 +1670,12 @@ QgsRectangle InputUtils::stakeoutPathExtent(
QgsGeometry InputUtils::stakeoutGeometry( const QgsPoint &mapPosition, const FeatureLayerPair &target, InputMapSettings *mapSettings )
{
if ( !mapSettings || !target.isValid() )
return QgsGeometry();
return {};

QgsPointXY targetInLayerCoordinates = target.feature().geometry().asPoint();
QgsPointXY t = transformPointXY( target.layer()->crs(), mapSettings->destinationCrs(), mapSettings->transformContext(), targetInLayerCoordinates );
const QgsPointXY targetInLayerCoordinates = target.feature().geometry().asPoint();
const QgsPointXY t = transformPointXY( target.layer()->crs(), mapSettings->destinationCrs(), mapSettings->transformContext(), targetInLayerCoordinates );

QVector<QgsPoint> points { mapPosition, QgsPoint( t ) };
const QVector<QgsPoint> points { mapPosition, QgsPoint( t ) };

return QgsGeometry::fromPolyline( points );
}
Expand Down
27 changes: 27 additions & 0 deletions app/mmtypeutils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

/**
* This file should be used for explicit declaration of 3rd party types into QML.
*/

#ifndef MMTYPEUTILS_H
#define MMTYPEUTILS_H

#include <qgsgeometry.h>
#include <qqmlintegration.h>

struct ForeignGeometry
{
Q_GADGET
QML_FOREIGN( QgsGeometry )
QML_VALUE_TYPE( qgsGeometry );
};

#endif //MMTYPEUTILS_H
1 change: 1 addition & 0 deletions app/multieditmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef MULTIEDITMANAGER_H
#define MULTIEDITMANAGER_H

#include <qgsgeometry.h>
#include <QObject>

#include "featurelayerpair.h"
Expand Down
6 changes: 4 additions & 2 deletions app/position/tracking/positiontrackinghighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "positiontrackinghighlight.h"

#include "inpututils.h"

PositionTrackingHighlight::PositionTrackingHighlight( QObject *parent )
: QObject( parent )
{
Expand All @@ -20,13 +22,13 @@ void PositionTrackingHighlight::recalculate()
{
if ( mMapPosition.isEmpty() )
{
setHighlightGeometry( QgsGeometry() );
setHighlightGeometry( InputUtils::emptyGeometry() );
return;
}

if ( mTrackedGeometry.isEmpty() )
{
setHighlightGeometry( QgsGeometry() );
setHighlightGeometry( InputUtils::emptyGeometry() );
return;
}

Expand Down
6 changes: 4 additions & 2 deletions app/qml/map/MMHighlight.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

import QtQuick
import QtQuick.Shapes
import QtQml

import mm 1.0 as MM
import MMInput

import ".."

Expand All @@ -19,7 +21,7 @@ Item {

// geometry to highlight
// geometry must be in map canvas CRS!
property var geometry
property qgsGeometry geometry

// for transformation of the highlight to the correct location on the map
property MM.MapSettings mapSettings
Expand Down Expand Up @@ -108,7 +110,7 @@ Item {
{
if ( !mapSettings ) return

if ( !geometry )
if ( __inputUtils.isEmptyGeometry( geometry ) )
{
// trigger repaint for empty geometries
markerItems = markerItems.map( function (marker) { return marker.destroy() } )
Expand Down
8 changes: 4 additions & 4 deletions app/qml/map/MMMapController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ Item {
}

function jumpToHighlighted( mapOffset ) {
if ( identifyHighlight.geometry === null )
if ( identifyHighlight.geometry.isNull )
return
let screenPt = __inputUtils.relevantGeometryCenterToScreenCoordinates( identifyHighlight.geometry, mapCanvas.mapSettings )

Expand All @@ -1394,7 +1394,7 @@ Item {
}

function hideHighlight() {
identifyHighlight.geometry = null
identifyHighlight.geometry = __inputUtils.emptyGeometry()
updatePosition()
}

Expand Down Expand Up @@ -1441,7 +1441,7 @@ Item {
case "view": {
// While a feature is highlighted we want to keep it visible in the map extent
// so in that case we skip centering to position
if ( identifyHighlight.geometry !== null )
if ( !__inputUtils.isEmptyGeometry( identifyHighlight.geometry ) )
{
break
}
Expand Down Expand Up @@ -1476,7 +1476,7 @@ Item {
// clear all previous references to old project (if we don't clear references to the previous project,
// highlights may end up with dangling pointers to map layers and cause crashes)

identifyHighlight.geometry = null
identifyHighlight.geometry = __inputUtils.emptyGeometry()
}

function setTracking( shouldTrack ) {
Expand Down
2 changes: 2 additions & 0 deletions app/qml/map/MMRecordingTools.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import QtQuick
import QtQuick.Shapes
import QtMultimedia
import QtQml
import QtQml.Models

import mm 1.0 as MM
import MMInput
Expand Down
21 changes: 21 additions & 0 deletions vcpkg/ports/qgis/geometry-equals-operator.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/src/core/geometry/qgsgeometry.h b/src/core/geometry/qgsgeometry.h
index 98e40e74e14..06fa2a78ddd 100644
--- a/src/core/geometry/qgsgeometry.h
+++ b/src/core/geometry/qgsgeometry.h
@@ -177,6 +177,16 @@ class CORE_EXPORT QgsGeometry
*/
QgsGeometry &operator=( QgsGeometry const &rhs ) SIP_SKIP;

+ /**
+ * Upstream QgsGeometry is missing equals operator overload and uses equals() to correctly check for equality.
+ * However QML in Qt 6.9+ also checks equality, before firing onChanged signal. The incorrect equality evaluation
+ * is breaking property bindings.
+ */
+ bool operator==( const QgsGeometry &rhs ) const
+ {
+ return equals( rhs );
+ }
+
/**
* Creates a geometry from an abstract geometry object. Ownership of
* geom is transferred.
3 changes: 3 additions & 0 deletions vcpkg/ports/qgis/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ vcpkg_from_github(
snapping-casting.patch
qflags-qstring-arg.patch
point-cloud-guard.patch
# TODO: when updating to QGIS 4, this has to be reworked to support new QgsGeometry
# comparison in QGIS 4
geometry-equals-operator.patch
)

file(REMOVE ${SOURCE_PATH}/cmake/FindQtKeychain.cmake)
Expand Down
Loading