When features have a temporal "range", we should never treat
that range as inclusive of the end (or we end up with features
appearing in multiple date ranges)
Completes fixes begun by @rduivenvoorde in https://github.com/qgis/QGIS/pull/40989Fixes#38468
during preparation wherever possible
In many situations we are able to optimize a case when expression
and replace it with a simpler expression node during the preparation
stage. Specifically, if the WHEN conditions are known to be
static values (such as those coming from certain expression context
variables) then we can often replace the whole condition node
with the THEN node of the first static true condition.
E.g.
CASE
WHEN @variable=1 THEN "first_field"
WHEN @variable=2 THEN "second_field"
ELSE "third_field"
END
If @variable is static and '1', then the whole expression node will ALWAYS
be identical to "first_field". Similiarly if @variable='2', then the
whole expression will ALWAYS be "second_field".
If we're able to apply this optimization, then we use the simplified
effective node which represents the whole node during evaluation
time and save a bunch of unnecessary work.
TODO: If we use the effective node during expression compilation
for providers we would be able to handoff more expressions involving
QGIS-side variables and other components to the backend, resulting
in increased use of backend provider indices, etc....
Follow up 56f7812ca1e
This commit fixed the ordering of features coming from the
vector layer cache for the attribute table, but came with a massive
speed impact due to the repeated calls QList::contains for
every feature fetched. For any moderately sized table or above
these calls stacked up into multiple minute delays in opening
the table.
Avoid this by tracking the added feature ids in a separate
unordered set, so that we don't need to check through the
ordered list for existing features at all.
Eg a 500k feature gpkg was taking 10 minutes to open the table.
With this optimization that's back down to 20 seconds.
This is not thread safe at all - we cannot access a layer from
an iterator, as iterators may be running on background threads.
Instead use a thread safe approach of storing a QgsVectorLayerFeatureSource
and using that instead
Fixes#38551
Allows users to manually opt-out of monitoring directories in
the browser by default, and also provides a mechanism for
enterprise installs to disable this potentially unwanted behavior.
are slow
Effectively this means that the browser no longer defaults to watching
network and remote drives (on Windows) for changes. This is expensive
to do and can result in large hangs in the QGIS application.
Users can still manually opt-in to monitoring of these locations
through the context menu of the directory in the browser panel.
items should be automatically monitored for changes
This monitoring can be expensive for some locations (eg network
folders or cloud based directories), so in these cases it is
desirable to allow it to be disabled to avoid hangs in the QGIS
application.
keyword in Python, so this value was previously inaccessible to PyQGIS
scripts
Also change all references to Qgis::MessageLevel values to their
fully qualified names, to ease a future transition to an enum
class (when sip bugs are fixed)
Fixes#42996
QFlags created from enum classes aren't automatically converted
from an int value passed by Python code, so we need to create
compatibility functions for the older variants which accept
plain ints