* fix PyQGIS API docs building
The current building of the PyQGIS API doc relies on the fact that the first line is a signature.
If not given, it should be empty.
* Update qgssettingsentry.py
Instead of hiding this information on the console, let's expose it
to users. QGIS startup times have been an ongoing issue for a number
of years, so let's help provide users with some tools to help
track down what's causing these (*hint* it's probably a plugin *hint*)
In C++ we do not support QgsProviderMetadata(key, description, createFunc) anymore,
but for python code we can have a patched class that still supports createFunc.
Why not keep the variant with createFunc in C++ as well? Because... SIP!
With newly added virtual methods in QgsProviderMetadata, SIP started to generate
a sip-specific subclass to handle derived classes in Python, however due to the variant
with PyObject* and custom MethodCode it was getting confused about what constructors
are available in C++ and failing to compile.
This line symbol type is designed to replicate the ArcGIS Hash Line
symbol layer type. It allows for a repeating line segment to be
drawn over the length of a feature, with a line-sub symbol used
to render each individual segment.
To reduce code duplication, this is heavily based off the current
line marker symbol layer, since the functionality is almost
identical (draw some sub symbol at some interval along a line).
Accordingly, I've split off QgsMarkerLineSymbolLayer to move
as much of the common functionality as possible to a new abstract
base class, so that only the actual marker/line segment rendering
occurs in the marker line/hash line subclasses.
This also gives the hash line all the existing placement options
permissible for marker lines -- e.g. first/last vertex, mid points,
regular intervals, etc.
The hash line length and angle can have data defined overrides,
which are evaluated per-line segment, allowing for the hash line
to change size and angle over the length of a single rendered
feature.
This allows nice and simple, elegant construction of checks for
Python.
To use, Python based checks should use the decorator syntax:
from qgis.core import check
@check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
def my_layout_check(context, feedback):
results = ...
return results
Or, a more complete example. This one throws a warning when attempting
to export a layout with a map item set to the Web Mercator projection:
@check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
def layout_map_crs_choice_check(context, feedback):
layout = context.layout
results = []
for i in layout.items():
if isinstance(i, QgsLayoutItemMap) and i.crs().authid() == 'EPSG:3857':
res = QgsValidityCheckResult()
res.type = QgsValidityCheckResult.Warning
res.title='Map projection is misleading'
res.detailedDescription='The projection for the map item {} is set to <i>Web Mercator (EPSG:3857)</i> which misrepresents areas and shapes. Consider using an appropriate local projection instead.'.format(i.displayName())
results.append(res)
return results
Up to date it was not possible to create a function that handles NULL values with the
@qgsfunction decorator. As soon as any parameter was NULL, the return value would also
be NULL.
Example of a function that returns a value now with a NULL paramter and would have returned NULL before
```
@qgsfunction(args=-1, group='Custom', handlesnull=True)
def mean_value(vals, feature, parent):
valid_vals = [val for val in vals if val != NULL]
return sum(valid_vals)/len(valid_vals)
```
[FEATURE]
* [pyqgis] add QgsSettings.enumValue and flagValue to the bindings
these are done in pure Python since no implementation is possible in SIP
there is a dirty hack for flags since QgsMapLayerProxyModel.Filters.__qualname__
returns 'Filters' and not 'QgsMapLayerProxyModel.Filters'
* fix typo