scls19fr
21st October 2012, 13:53
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...
8339
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
scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
but it doesn't work as expected (there is a lot of empty space around the QGraphicsProxyWidget
scene = new QGraphicsScene;
QWebView *web;
web = new QWebView();
web->load(QUrl("http://news.google.fr"));
web->show();
QWebView *web2;
web2 = new QWebView();
web2->load(QUrl("http://www.google.com"));
web2->show();
proxy = new QGraphicsProxyWidget();
proxy->setWidget(web);
proxy2 = new QGraphicsProxyWidget();
proxy2->setWidget(web2);
scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
ui->graphicsView->setScene(scene);
ui->graphicsView->show();
Any help is welcome because... I haven't the finest idea to fix this problem !
Kind regards
Sébastien
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...
8339
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
scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
but it doesn't work as expected (there is a lot of empty space around the QGraphicsProxyWidget
scene = new QGraphicsScene;
QWebView *web;
web = new QWebView();
web->load(QUrl("http://news.google.fr"));
web->show();
QWebView *web2;
web2 = new QWebView();
web2->load(QUrl("http://www.google.com"));
web2->show();
proxy = new QGraphicsProxyWidget();
proxy->setWidget(web);
proxy2 = new QGraphicsProxyWidget();
proxy2->setWidget(web2);
scene->setSceneRect(proxy2->geometry().x(), proxy2->geometry().y(), proxy2->geometry().width(), proxy2->geometry().height());
ui->graphicsView->setScene(scene);
ui->graphicsView->show();
Any help is welcome because... I haven't the finest idea to fix this problem !
Kind regards
Sébastien