QField icon indicating copy to clipboard operation
QField copied to clipboard

Apply custom logic to feature click

Open woutergd opened this issue 1 year ago • 4 comments

Hi all,

Just a question. We are working on a plugin, and want to apply some custom logic after a feature has been clicked in a vector layer, instead of showing the regular featurelist / attribute list.

Based on what I found in the code was my idea to set the layer itself as not-identifyable within the QGis-project to disable the default behaviour for a layer, and then manually pass the click-event through the Identifytool (or some kind of similar logic) to retrieve the feature that is clicked on.

However, I tried to capture both events within the identifytool and the mapcanvas, but I don't seem to get any response.

Can anyone point me in the right direction to get this behaviour integrated in a plugin. If it require any modification in the utils or code itself just let me know where to start, then I will try to get this implemented and propose as PR.

woutergd avatar Dec 23 '24 10:12 woutergd

@woutergd , that's not something available ATM, but I can definitively see it being super useful for plugin authors. I imagine a system whereas we can register a listener against a tap listeners bank, and conditionally take ownership of the tap, preventing default identify behavior.

Feel most invited to open a PR, and ask questions along the way.

BTW, we very much appreciate these enhancement requests being opened before PRs, it allows for a discussion that can ultimately avoid wasted energy :)

nirvn avatar Dec 30 '24 07:12 nirvn

@nirvn thanks for your input, we will start to implement this.

My idea was to start at an intercept on the IdentityTool, so we can intercept it with the features already detected. Does that fit your idea, or is a more basic integration with the taplistener itself more in line with the plugin framework of QField?

woutergd avatar Jan 03 '25 11:01 woutergd

@woutergd , greetings; have you guys made progress on this?

nirvn avatar Mar 30 '25 07:03 nirvn

@woutergd , a framerwork has been coded and is being reviewed here: https://github.com/opengisch/QField/pull/6328 -- does this fit your needs?

nirvn avatar Jun 02 '25 01:06 nirvn

Implemented. While I'm closing this now, I'm still eager to hear from you @woutergd :)

nirvn avatar Sep 11 '25 12:09 nirvn