Zooming function on a QWidget
Try to reimplement your paintEvent , and apply scale to QPainter before drawing.
class YourClass:public QWidget
{
...
protected:
void paintEvent ( QPaintEvent * event );
void wheelEvent ( QWheelEvent * event );
private:
qreal scale;
};
void YourClass::paintEvent ( QPaintEvent * event )
{
QPainter p;
p.scale(scale,scale);
// paint here
}
void YourClass::wheelEvent ( QWheelEvent * event )
{
scale+=(event->delta()/120); //or use any other step for zooming
}