Hi all,
this is a little follow up on the old Plasma Active webbrowser thread.
http://www.mail-archive.com/[email protected]/msg02851.html
as probably already heard, the qt demo browser has a problem when used in
plasma-desktop or in any case its application has more than one qgraphicsview
open on the same scene: all that can be seen is a sad checkerboard.
it's strange since it seems to happen only in qml and not in qgraphicswebview,
but the qml widget in turn uses a qgraphicswebview.
so I sat down and tried to figure out where it happens...
it seems it's indeed a problem in qgraphicswebview, but only when the tiled
backing store option is enabled, that's why happens only in qml, where this
option is enabled by default.
now, it seems it's necessary to know the view geometry, but of course if there
is more than one view in the same scene isn't possible to be mathematically
sure what view is the right one (in cases of overlapping scenerects)
this patch solves this for me, but i'm aware that fixes the problem only for
99.99% of the real world usage cases, so i don't know if this would be suited
for inclusion since is still possible to craft a case where it would fail
(i.e. views weirdly intersecating their scenerects) i think anyways that would
be better than simply silently not painting anything when there is more than
one view, that honestly makes it, at least in our use case, nearly useless.
there would be other ways to solve it in a standalone browser, like having a
scene per page, but the component would still be useless in plasma-desktop,
and this is still a quite major problem for us.
any ideas or comments how to solve it differently? or this looks robust
enough?
Cheers,
Marco Martin
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index b63921b..1fdca18 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
@@ -427,18 +427,35 @@ QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const
if (!q->scene())
return QRectF();
QList<QGraphicsView*> views = q->scene()->views();
- if (views.size() > 1) {
-#ifndef QT_NO_DEBUG_STREAM
- qDebug() << "QGraphicsWebView is in more than one graphics views, unable to compute the visible rect";
-#endif
+
+ if (views.size() < 1)
return QRectF();
+
+ QGraphicsView *view = 0;
+ if (views.size() == 1) {
+ view = views[0];
+ } else {
+ QGraphicsView *found = 0;
+ QGraphicsView *possibleFind = 0;
+ foreach (QGraphicsView *v, views) {
+ if (v->sceneRect().intersects(q->sceneBoundingRect()) ||
+ v->sceneRect().contains(q->scenePos())) {
+ if (v->isActiveWindow()) {
+ found = v;
+ } else {
+ possibleFind = v;
+ }
+ }
+ }
+ view = found ? found : possibleFind;
}
- if (views.size() < 1)
+
+ if (!view)
return QRectF();
- int xPosition = views[0]->horizontalScrollBar()->value();
- int yPosition = views[0]->verticalScrollBar()->value();
- return q->mapRectFromScene(QRectF(QPoint(xPosition, yPosition), views[0]->viewport()->size()));
+ int xPosition = view->horizontalScrollBar()->value();
+ int yPosition = view->verticalScrollBar()->value();
+ return q->mapRectFromScene(QRectF(QPoint(xPosition, yPosition), view->viewport()->size()));
}
#if ENABLE(TILED_BACKING_STORE)
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq