Misha, I must be missing the point then. Please help me understand. My issue is not actually with the scroll position; it is with the size of the QGraphicsWebView.
The problem: I create the QGraphicsWebView and add it to a graphicsscene. By default the size is 640x480 (I believe). When I load a page it will not resize itself automatically, it will add scrollbars if the main frame/contents are larger than 640x480. Instead of using the "scroll bars" on the frame, I want to implement a finger kinetic scrolling. Pretty much like http://doc.qt.nokia.com/qt-maemo/maemo5-graphicswebview.html but not just for maemo (the example resizes the QGraphicsWebView ONLY after loading the page). To accomplish this I need to resize the QGraphicsWebView to the size of the mainframe everytime it changes so, in theory, no scrollbars would be needed. My GraphicsView then will be in charge of handling any scrolling. The issue, like I said before, is that the page (gmail mobile) will resize the contents when I change the size of the QGraphicsWebView. The more I think about this issue, the more I believe is not actually a Webkit bug. It is an issue with the web site that ALWAYS tries to have a scrollbar regardless of the size of the window. If anything, the bug with Webkit is to "allow for the infinite" loop when using resizeToContents. But I still have to wonder how the other browsers handle it (safari, android, ...) I have done this using QWebView but was trying to do the same using QGrahicsWebView to see if it would be any better (especially on symbian) Thanks, Felipe -----Original Message----- From: Misha Tyutyunik [mailto:[email protected]] Sent: Tuesday, March 22, 2011 11:55 AM To: ext Felipe Crochik Subject: Re: [webkit-qt] QGraphicsWebView - resize to contents - Help? Felipe, My point was that you can use QGraphicsWebView without re-size to content. This would mean that your scrolling will use webkit setScrollPosition and not QGraphicsItem::setPos(). You can still use scale() for zooming. The downside of it that on some pages fixed positioned elements might cover big portion of the phone screen (things like flying banners etc). On the other hand you will use webkit as designed. IMHO, re-size to contents is a hackish solution and it has issues with JavaScript. In order to use it you need to call QWebPage::setActualVisibleContentRect() every time when you get scrollRequested signal from webkit or when you have resize event. setActualVisibleContentRect() will basically update the webkit scroll position - similar to what you've tried to do. Misha On 03/22/2011 11:02 AM, ext Felipe Crochik wrote: > Misha, > > I tried the resizetoContents (only on Qt 4.7) and manually to listen to the > "mainframe.contentsChanged" signal (qt 4.6) so I could adjust the size of > the QGraphicsWebView accordingly. Is there another way to accomplish showing > the QGraphicsWebView in a QGraphicsView? > > I tried the resizetocontents but in reality for now I am stuck with Qt4.6 > because of symbian/ovi. > > Cheers > Felipe > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Misha Tyutyunik > Sent: Tuesday, March 22, 2011 10:56 AM > To: [email protected] > Subject: Re: [webkit-qt] QGraphicsWebView - resize to contents - Help? > > As far as I remember there were some fixes in 4.7 that improved > performance of qt rendering. > > Felipe, > Any reason why you need to use re-size to contents? > > Misha > > On 03/22/2011 09:50 AM, ext Felipe Crochik wrote: >> Ariya, >> >> Thank you for your reply. >> >> I looked at the documentation and tried to change the viewport to no > effect. >> I assume internally the QGraphicsWebView will change the page viewport to >> render each one of the tiles. >> >> The only other work around I could come up with is to change the "scroll >> position" of the mainframe depending on the scroll position of the >> QGraphicsWebView but it is anything but pretty :). >> >> My goal was actually to replace my implementation using QWebView with >> QGraphicsWebView in the hope that would work better on the Symbian^3 > running >> Qt 4.6. I have experienced issues with it. I can only get a "perfect" zoom >> if I use the "raster" system but the raster system on the "top" (E7/N8) >> devices makes the device sluggish. Odd enough the raster does not affect > the >> performance on the C7. >> >> I will run some tests using the Qt4.7 for symbian and hope that "soon" > will >> be officially available. >> >> Thanks, >> Felipe >> >> -----Original Message----- >> From: Ariya Hidayat [mailto:[email protected]] >> Sent: Monday, March 21, 2011 5:57 PM >> To: Felipe Crochik >> Cc: [email protected] >> Subject: Re: [webkit-qt] QGraphicsWebView - resize to contents - Help? >> >> I wonder if the trick in >> http://qt.gitorious.org/qt-labs/graphics-dojo/trees/master/webcapture, >> i.e. using the frame content size and page viewport size would work. >> Note: that example is using QWebPage directly, not QGraphicsWebView. >> >> > _______________________________________________ > webkit-qt mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt > _______________________________________________ webkit-qt mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
