Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在Qt中缩放图形_C++_Qt_Graphics_Zooming - Fatal编程技术网

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