C++ 在Qt中缩放图形
我使用C++ 在Qt中缩放图形,c++,qt,graphics,zooming,C++,Qt,Graphics,Zooming,我使用QGraphicsView和qgraphicscene来绘制图形如何组织放大和缩小(放大时应显示卷轴,缩小时应消失卷轴) 如果场景适合视图大小,滚动条将自动消失 问候,, 瓦伦丁 如果场景适合视图大小,滚动条将自动消失 问候,, 瓦伦丁 QGraphicsView::scale(qreal, qreal) e.g. QGraphicsView * view = new QGraphicsView (parent); QGraphicsScene *scene = new QGraphi
QGraphicsView
和qgraphicscene
来绘制图形如何组织放大和缩小(放大时应显示卷轴,缩小时应消失卷轴) 如果场景适合视图大小,滚动条将自动消失 问候,, 瓦伦丁 如果场景适合视图大小,滚动条将自动消失 问候,, 瓦伦丁
QGraphicsView::scale(qreal, qreal)
e.g.
QGraphicsView * view = new QGraphicsView (parent);
QGraphicsScene *scene = new QGraphicsScene();
scene->addText("Hello World");
view->setScene(scene);
view->show();
view->resize(100,100);
// coll from some slot to see the effect
view->scale(2,2); //zoom in
view->scale(.5,.5); //zoom out