Using QGIS expressions, it's easy to create a polygon with the extent (bounding box) covering all geometries of a layer using layer_property(@layer,'extent').
However, how do I get a polygon covering the whole layer extent, not only the extent of the geometry?
See the screenshot: the expression generates the blue polygon. However, I look for an expression generating a polygon symbolized here with the pink frame:



layer_property('OpenStreetMap','extent')without need of loading another layer (OpenStreetMap). – Babel Jun 24 '21 at 11:07