Centered zoom in a qgraphicswebview



  • Hi everyone,

    I'm trying to do a centered zoom in a qgraphicswebview using setScale, unfortunately it zooms at coordinates 0,0 and I'd like to have it zoomed to the center.
    How can I do this?

    Thank you.

    mrA



  • Did you try something like this :
    @yourWebView->setTransformOriginPoint(yourWebView->boundingRect().center());@



  • I tried something like this some time ago but I had problems when panning the view...I wasn't able to pan it everywhere like it was blocked to a smaller "bounding" rect...



  • I think the panning is limited to the scene or view sceneRect.
    Maybe you called setSceneRect with that "smaller bounding rect" ?



  • I simply do :

    @void MyWebView::centeredZoom(qreal delta)
    {
    webview->setTransformOriginPoint(webview->boundingRect().center());
    webview->setScale(webview->scale() + delta);
    }@

    It zooms centered but if I try to pan after a zoom I'm not able to reach the upper-left part of the webpage. Moreover the lower-right part is something out of the page.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.