When a profile tool is already opened, the output of a procssing is
not added to its layer tree. This is because it relies on a
`QgsLayerTreeRegistryBridge`. Indeed, `QgsLayerTreeRegistryBridge`
listens to the `QgsProject::legendLayersAdded()` signal in order to
update the elevation profile tree view. However this signal is not
triggered by the current logic in `Postprocessing.py`because
`QgsProject::addMaplayer` is called with `addToLegend` set to
False. Then, the layer is added to the tree by calling
`QgsLayerTreeGroup::insertChildNode`.
This issue is fixed by creating a
`QgsLayerTreeRegistryBridge::InsertionPoint` to set the insertion
point and then calling `QgsProject::addMaplayer` with `addToLegend`
set to True.
This change is similar to the previous commit on feature addition.
When a feature is removed from a `QgsVectorLayer`
`QgsVectorLayer::deleteFeature` is called. This function makes mostly
2 things in case of a successful operation:
1. it calls `QgsVectorLayerEditBuffer::deleteFeature` which itself
will emit the `QgsVectorLayerEditBuffer::featureDeleted`
signal. Finally, `QgsVectorLayer` listend to this signal to
directly emit the `QgsVectorLayer::featureDeleted` signal
2. Call `QgsVectorLayer::updateExtents()` to invalidate the cache of
the extent
In practice, this means that the `QgsVectorLayer::featureDeleted`
signal may be emitted before the cache of the extent is
invalidated. This can cause some issues.
This issue is solved by calling `updateExtents()` before emitting the
`featureDeleted` signal.
When a new feature is added to a `QgsVectorLayer`
`QgsVectorLayer::addFeature` is called. This function makes mostly 2
things in case of a successful operation:
1. it calls `QgsVectorLayerEditBuffer::addFeature` which itself will
emit the `QgsVectorLayerEditBuffer::featureAdded` signal. Finally,
`QgsVectorLayer` listend to this signal to directly emit the
`QgsVectorLayer::featureAdded` signal
2. Call `QgsVectorLayer::updateExtents()` to invalidate the cache of
the extent
In practice, this means that the `QgsVectorLayer::featureAdded` signal
may be emitted before the cache of the extent is invalidated. This can
cause some issues.
For example, in the elevation profile tool,
`QgsElevationProfileCanvas` listens to the
`QgsVectorLayer::featureAdded` signal in order to regenerate the
profile of a vector layer when a feature is added. This causes the
creation of a new `QgsVectorLayerProfileGenerator` which needs to copy
the extent of the vector layer. However,
`QgsVectorLayer::updateExtents()` has not been called yet. Thus, it
will use an outdated version of the extent.
This issue is solved by calling `updateExtents()` before emitting the
`featureAdded` signal.
master authentication password and store in keychain
This avoids the need for users to manually create a pw, and makes
things MUCH nicer for plugins which want to utilise the secure
authentication framework.
Right now the options for plugins are:
1. Create a auto generated password themselves and force it on
the user (basically what we are doing here automatically now)
2. Show a confusing/scary message to users asking them to set
a master password. From my experience users have NO idea what
this means and consider it a QGIS bug.
We can't silence the constructor deprecation warning
when used with make_unique, so just remove the constructor
deprecated flag.
This is a private class, not exposed to Python, and only
used from within QGIS by a class which is itself completely
deprecated (and marked accordingly).
These don't exist on the backend, so just hide them from the builder
dialog to avoid user confusion.
(Note that it's impossible to show the actual non-proxy fields
here, as we can ONLY show fields with types compatible with native
QGIS field types in this dialog)
Fixes#59528
Instead of resetting the size to a default size, use the actual size
of the annotation item at the current map scale as the initial fixed
size.
Fixes#59189