From 361d6ed4c33f4bbfacb99b6287145230b7946056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 26 Mar 2012 19:19:58 +0200 Subject: [PATCH] Navigate to the GraphicsView's toplevel widget to find the thumbnail's window The GraphicsView which renders the ThumbnailItem does not have to be a toplevel widget. If it has a parent we have to navigate to the top level parent widget and compare the window Id on this widget. If it matches the one of the window we are currently rendering, we know that we found the correct GraphicsView. Reviewed-By: Philipp Knechtges --- scene.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scene.cpp b/scene.cpp index 340402e417..4e69121387 100644 --- a/scene.cpp +++ b/scene.cpp @@ -379,6 +379,20 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad declview = view; break; } + QWidget *parent = view; + while ((parent = parent->parentWidget())) { + // if the graphicsview is not the topmost widget we try to go up to the + // toplevel widget and check whether that is the window we are looking for. + if (parent->winId() == w->window()->window()) { + declview = view; + break; + } + } + if (declview) { + // our nested loop found it, so we can break this loop as well + // doesn't look nice, but still better than goto + break; + } } if (declview == 0) { continue;