Force widget resizing in Qt
I'm writing an image viewer, and I'd like some behavior from Qt:
imagine the viewer displays the image in a 256x256 box. Now I want that ctrl+Z do a zoom + resizing of the window; ie. show the 2x zoomed image in a 512开发者_运维百科x512 box, how can I do that?
Also, imagine know the user gave a certain shape to my viewer, and that he presses F10, I want to change the layout to display the viewer in the same size (if possible, eg not overflowing the screen) and add additional controls under it, and resize the complete widget in a way that the viewer widget does
Maybe you could use the QWidget::minimumSize property to change the widget minimal size.
If the size of your zoomed image gets bigger than the screen, you might have to put your widget into a QScrollArea.
精彩评论