Hello,

I've done a little Qt application with a QGraphicsScene in which I display 2 QWebView widgets.
There is 2 buttons (next and previous) to display 1 webview at a time (in fact its associated QGraphicsProxyWidget)
or the other one (with a QVariantAnimation that allows rotating QProxyWidgets around Y-axis).
it is a kind of panel that turns around its Y-axis.

Code is sometimes easier to understand so...
qgraphicsscene.zip

My problem is that I would like to have my QProxyWidget fills the QGraphicsView (zoom fit with - keep width/height ratio)

I probably don't understand something...

I tried to change the scene properties with
Qt Code:
  1. scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
To copy to clipboard, switch view to plain text mode 

but it doesn't work as expected (there is a lot of empty space around the QGraphicsProxyWidget

Qt Code:
  1. scene = new QGraphicsScene;
  2.  
  3. QWebView *web;
  4. web = new QWebView();
  5. web->load(QUrl("http://news.google.fr"));
  6. web->show();
  7.  
  8. QWebView *web2;
  9. web2 = new QWebView();
  10. web2->load(QUrl("http://www.google.com"));
  11. web2->show();
  12.  
  13. proxy = new QGraphicsProxyWidget();
  14. proxy->setWidget(web);
  15.  
  16. proxy2 = new QGraphicsProxyWidget();
  17. proxy2->setWidget(web2);
  18.  
  19. scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
  20.  
  21. ui->graphicsView->setScene(scene);
  22. ui->graphicsView->show();
To copy to clipboard, switch view to plain text mode 

Any help is welcome because... I haven't the finest idea to fix this problem !


Kind regards

Sébastien