From 57a4d2c584b5af0cbfdfd084cfabed4c44903f78 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 17 Jan 2024 14:07:34 +0100 Subject: [PATCH] Fix LayerSurface to work as attached properties --- src/interfaces/layersurface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interfaces/layersurface.cpp b/src/interfaces/layersurface.cpp index 6884ddc..d8f7af5 100644 --- a/src/interfaces/layersurface.cpp +++ b/src/interfaces/layersurface.cpp @@ -255,7 +255,12 @@ void LayerSurface::setLayerEnabled(bool enabled) LayerSurface *LayerSurface::get(QWindow *window) { - return globalLayerSurfaces->value(window, nullptr); + if (globalLayerSurfaces->contains(window)) + return globalLayerSurfaces->value(window); + + auto *layerSurface = new LayerSurface(); + globalLayerSurfaces->insert(window, layerSurface); + return layerSurface; } LayerSurface *LayerSurface::qmlAttachedProperties(QObject *object)