Iam using mouse wheel to zoom my view,I have a condition not to zoom out scene below original.
But when i zoom out to original size I dont see original size ,some part is not visible in view port.
When I debugged I found that if I zoom out from a zoomed scene ,just before it reaches scene's original size
my factor becomes 0.9999 so my condition fails and it doesn't zoom out anymore.
Can anybody point our for me if I am doing something wrong here.
{
qreal delta=pow((double)2,(event->delta())/ 120.0);
qreal factor
= matrix
().
scale(delta, delta
).
mapRect(QRectF(0,
0,
1,
1)).
width();
if (factor < 1.000 || factor > 100)
return;
this->scale(delta,delta);
}
void MyView::wheelEvent(QWheelEvent* event)
{
qreal delta=pow((double)2,(event->delta())/ 120.0);
qreal factor = matrix().scale(delta, delta).mapRect(QRectF(0, 0, 1, 1)).width();
if (factor < 1.000 || factor > 100)
return;
this->scale(delta,delta);
}
To copy to clipboard, switch view to plain text mode
Bookmarks