qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.04k stars 2.92k forks source link

Atlas-related variables unavailable in select by expression dialog #40069

Open DelazJ opened 3 years ago

DelazJ commented 3 years ago

I don't know whether it has been available in the past or not, so feel free to turn it into feature request depending on the status.

It's not possible to refer to atlas feature properties when using the selection tool. But i can imagine contexts where someone would like to select features in a layer based on whether they share (or not) common attributes or some spatial relationship with the atlas feature.

left (the select by expression tool) right (the expression dialog from symbology) - same layer image

QGIS version 3.16.0-Hannover QGIS code branch Release 3.16 (9e55f5e99)
Compiled against Qt 5.12.8 Running against Qt 5.12.8
Compiled against GDAL/OGR 3.0.4 Running against GDAL/OGR 3.0.4
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.4 (Ubuntu 12.4-0ubuntu0.20.04.1) SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.2
Compiled against PROJ 6.3.1 Running against PROJ Rel. 6.3.1, February 10th, 2020
OS Version Ubuntu 20.04.1 LTS This copy of QGIS writes debugging output.
Active python plugins db_manager; MetaSearch; processing
roya0045 commented 3 years ago

I would guess that simply doing context.appendScope to the context made here https://github.com/qgis/QGIS/blob/8eb1a45e219c480bb78affb3ee797f9e7b47a6bc/src/gui/qgsexpressionselectiondialog.cpp#L58 with a scope made with a nullptr like https://github.com/qgis/QGIS/blob/072222d2fd4850f1ae73a58817ccfd22b6c5dfda/src/gui/symbology/qgssymbolwidgetcontext.cpp#L97 would do the trick.

roya0045 commented 3 years ago

I think this is more of a feature request than a bug judging from the code.

roya0045 commented 3 years ago

100% feature request and potentially unstable anyway. This will never occur in a layout and this will never have a definite atlas and may cause strange behaviour in some cases. Which is not the case for rendering.