If the image is to be shown entirely, the label needs to have a size big enough to show the whole image.
In which case the easiest way is to resize the label appropriately and let it scale the pixmap.
See comment #4
Cheers,
_
If the image is to be shown entirely, the label needs to have a size big enough to show the whole image.
In which case the easiest way is to resize the label appropriately and let it scale the pixmap.
See comment #4
Cheers,
_
Ok, so:
1) if I fix a size big enough to contain the image larger, if the image is not zoomed in that moment there will be empty spaces between the label and the image?
2)how can I connect this operation (scaling of the image) with the changes of the vertical bar?
Thank you
Because you wrote "If the image is to be shown entirely, the label needs to have a size big enough to show the whole image."
I have to zoom it showing it entirely.
Can you show me some code to understand how to do the second point (vertical bar)?
I think we have a communication problem here. You are using the word "zoom". For us, to "zoom" an image means that you scale the image to make it larger ("zoom in") or smaller ("zoom out") than the rectangle it is displayed in.
In most image display applications, the window stays the same size, so when you "zoom in" only part of the image is displayed, and usually scrollbars are shown so you can move to different parts of the image. When you "zoom out", more of the image is visible and as you zoom out more, the image becomes smaller than the window in which it is displayed and the scrollbars are removed. Zooming scales the image while the window size does not change.
If you resize the window (by dragging the window to make it larger or smaller) the zoom level does not change, but more or less of the image is shown. Resizing the window does not scale the image.
So, please explain exactly what you want to happen when you move your vertical bar:
1) Do you want the window that the image is displayed in to get larger? (Resize the window, image stays the same size)
2) Do you want the image to get larger or smaller? (Zoom the image, window stays the same size)
3) Do you want both the window and the image to change size? (Zoom the image and at the same time make the window larger or smaller so the whole image is visible)
Thank you d_stranz, maybe we have been a misunderstanding as you said.
By the way, I partly solved the last problem so now I have a label with a fixed size and
when I zoom in the image it becomes partially visible.
How can I use the horizontal and vertical scrollbars in order to show the image completely?
I have written the code "connect...ecc...." and the relative signals and slots but I cannot find
a code for the function to connect to the scrollbars.
Look at the example in the QScrollArea widget. It does exactly what you are trying to do, and maybe you will look like the guy in the photo afterward.How can I use the horizontal and vertical scrollbars in order to show the image completely?
Bookmarks