Clarification on Signal Exposure in QField Plugins #5892
paul-carteron
announced in
Q&A
Replies: 1 comment 1 reply
-
@paul-carteron , every Q_OBJECT or Q_GADGET class exposed in our QML environment (see https://github.com/opengisch/QField/blob/master/src/core/qgismobileapp.cpp#L366 to see a list of those objects and gadgets exposed) will have their signals exposed to our QML environment. It is possible a signal containing parameter types that are not exposed in the QML environment will be skipped. It's not something I've tested before, but I can see a disabling logic there :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I’ve been working on QField plugin and recently started exploring the use of signals. If I understand correctly, signals from QGIS classes can be accessed in QML when the class is exposed. For example, I’ve successfully connected to signals from
QgsVectorLayer
likefeatureAdded
andgeometryChanged
in QML using the following:This works perfectly, but I’m trying to understand how to confirm whether signals for a specific class are fully exposed to QML or if there’s a custom mechanism in QField that bridges these signals.
From my understanding,
QgsVectorLayer
is exposed to QML with :qmlRegisterType<QgsVectorLayer>( "org.qgis", 1, 0, "VectorLayer")
Does this mean that all
QgsVectorLayer
signals (likefeatureAdded
,geometryChanged
,committedFeaturesAdded
, etc.) are automatically available in QML?I’ve reviewed files like layerobserver.cpp and featurelistmodel.cpp, which appear to connect
QgsVectorLayer
signals internally. However, in the plugin I usetarget:my_layer
(aQgsVectorLayer
instance) and not to something likelayerObserver
.I’d appreciate it if you could clarify:
QgsVectorLayer
signals exposed to QML by default, or is there a custom mechanism in QField for signal exposure?Apologies if my question isn’t clear—I’m still learning about Plugin development with Qfield.
Thank you in advance !
Beta Was this translation helpful? Give feedback.
All reactions