I am writing a Python method which I want the mouse click event to connect to. The method selects objects from layers that satisfy certain conditions. I want to select from any visible layer, that has features in the current map extent.
To evaluate which layer is visible I check the property:
QgsProject.instance().layerTreeRoot().findLayer(layer.id()).isVisible()
There are some layers with scale dependent visibility. I don't want to select objects from layers, that are not visible due to the current map scale.
isVisible() from the line of code above returns True, even if the layer is not visible due to the current scale, but is checked in the legend tree.
My question: is there another way to check if a layer with scale based visibility is out of the visible scale interval, then comparing the map scale with minimumScale() and maximumScale() of each layer?