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 <philipp-dev@knechtges.com>
icc-effect-5.14.5
Martin Gräßlin 2012-03-26 19:19:58 +02:00
parent 8011e80652
commit 361d6ed4c3
1 changed files with 14 additions and 0 deletions

View File

@ -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;