Is it possible to access the QGIS Map Canvas as a variable or expression value to be used in the field calculator or labelling engine?
(i.e. so that you can create an expression that selects/interrogates features that are visible/present in a particular view of the canvas in a similar way that the print composer 'filters the legend by map content')
(QGIS 2.18.1 [osgeo4w], win7)
EDIT:
Potential (fictional) use case 1 - There are 50 polygon's in a layer, currently there are 20 polygon's visible in the current view of the map canvas, I would like to style the polygon's blue if there are <= 25 polygon's visible or style them green if there are >= 25 polygon's visible.
Potential (fictional) use case 2 - There are 50 polygon's in a layer, currently there are 10 polygon's visible, 5 that have an attribute value of 'House' in the "Building Type" field/column, and 5 that have the value of 'Garage' in the "Building Type" field/column, visible in the current view of the map canvas. Return: the value equalling the number of polygon's that are garages ... answer = 5.
is_selectedfunction to know if a feature is selected. Might be worth to have more details on what you would like to do.