QGraphicsView scale: can scale down with negative numbers or up with positive numbers but need it to roll round (big, big, big, back to start, big, bi
I have solved this using
but thought I would post anyway in case it helps anyone else............
I have a QGraphicsView which I am using the scale the content of the screen but (to match spec) I need the 'zoom' to be with a single key (rather than one for up and one for down). The screen should zoom from 'normal' in to a defined maximum then start from 'normal' again.
If I use positive scale values I get the required zoom in. If I use negative scale values I get a zoom out. If I try to wrap around the positive numbers work fine but the negative numbers (instead of zooming out) turn the image UPSIDE DOWN!
Just create a new [[doc:QTransform]] based on the required zoom level, and set that on the view, instead of calling scale() directly. That way, you won't be modifying the existing zoom, but just setting a new value. All you need to do is create your range of accepted values, and choose the next one.
Even better thanks - any way of simply scaling a QPushButton (outside of a QGraphicsView)? I may have to do the scaling manually since everything has to stay on the screen - seems a bit over the top to have to change the button, icon and font size.
Learning, learning, learning..........
Nope. In QML, this would be trivial, but in the widget world these kinds of scenario's were not taken into account.