Try QGraphisPixmapItem:
"http://doc.qt.nokia.com/4.7/qgraphicspixmapitem.html#details":http://doc.qt.nokia.com/4.7/qgraphicspixmapitem.html#details
The easiest way: You can set the scale of the QGraphicsView:
"http://doc.qt.nokia.com/4.7/qgraphicsview.html#scale":http://doc.qt.nokia.com/4.7/qgraphicsview.html#scale
The "scale" method uses two factors, one for X and another for Y. As I understand, you will always keep the Y factor as 1.0 .
But before setting a new scale (a particular case of transformation), you will need to reset the previous transformation:
"http://doc.qt.nokia.com/4.7/qgraphicsview.html#resetTransform":http://doc.qt.nokia.com/4.7/qtransform.html#scale
A bit more complicated, as that might be a little bit more slower than really understanding the transformations and applying a calculated one, adjusted for the difference in scale, rather than reseting and setting a new one.
Create a QTransform and apply to it the scale you need:
"http://doc.qt.nokia.com/4.7/qtransform.html#scale":http://doc.qt.nokia.com/4.7/qtransform.html#scale
Then apply it to the QGraphicsView without combining it with the previous transformation:
"http://doc.qt.nokia.com/4.7/qgraphicsview.html#setTransform":http://doc.qt.nokia.com/4.7/qgraphicsview.html#setTransform
Your resize event might do this:
get new width;
calculate the ratio between this and the first ever width;
create a QTransform object and set its scale properly;
apply this to the QGraphicsView using its setTransform method without combination to the previous;
OR
get new width;
calculate the ratio between this and the last one;
save width for future use;
create a QTransform object and set its scale properly;
apply this to the QGraphicsView using its setTransform method combining it to the previous;
I have never tried to do this, but I guess that will work as expected.
Hope this helps,
Francisco