【发布时间】:2016-08-23 12:55:02
【问题描述】:
如何重置图形视图的比例,而不考虑之前应用的任何比例?使用scale() 将我给它的比例乘以前一个:
ui->graphicsView->scale(0.1, 0.1);
ui->graphicsView->scale(2, 2);
// the scale factor is (0.2,0.2) instead of (2,2)
【问题讨论】:
标签: c++ qt qgraphicsview
如何重置图形视图的比例,而不考虑之前应用的任何比例?使用scale() 将我给它的比例乘以前一个:
ui->graphicsView->scale(0.1, 0.1);
ui->graphicsView->scale(2, 2);
// the scale factor is (0.2,0.2) instead of (2,2)
【问题讨论】:
标签: c++ qt qgraphicsview
QGraphicsView::resetMatrix() 重置矩阵,并在应用比例之前调用它:
view->scale(0.1, 0.1);
view->resetMatrix();
view->scale(2, 2);
// the scale factor is (2,2)
【讨论】:
补充一点:
QGraphicsView::resetMatrix()等于QGraphicsView::resetTransform(),从源码可以看出:
void QGraphicsView::resetMatrix()
{
resetTransform();
}
【讨论】: