Access non geometry layer for Plugin #5877
-
Hi, I'm attempting to access a non-geometrical layer to enumerate all values within a specific field. While I can retrieve
Additionally, I've observed that Is there a method to access non-geometrical layers within QField's QML environment? Below my qml to test layer acces :
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@paul-carteron , have you tried this function: https://api.qgis.org/api/classQgsProject.html#a935efacacb942a15afe19728233e35c3 ? In the qml plugin environment you can access the current project via the qgisProject object. So provided you know your layer name you could do qgisProject.mapLayersByName("my layer"). |
Beta Was this translation helpful? Give feedback.
-
@nirvn It works perfectly, thank you! I wasn’t aware that
You - obviously - already know all this, but I'm writing more with the goal of documenting and centralizing ressources. With that in mind, I couldn’t find where it’s explicitly documented that |
Beta Was this translation helpful? Give feedback.
Pro tip: in the QGIS documentation, you can see properties accessible in QML within the properties section, and you can see which functions are exposed by spotting the Q_INVOKABLE tags.