Can't resize window
I need to set a fixed size for my entire application (all screens will have the same size).
Even if the content won't fit, I would want the window size to remain fixed (and maybe hide some content).
setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored); setFixedSize(width,height);
in my MainWindow.
But it doesn't work. The window always fits the content.
How do I resize it to a fixed width and height?
- the widgets in the window are assigned dynamically
Why not use the Fixed QSizePolicy ?
Also, do you mean fix the size of the main widget or are you fixing the size of all the widgets of your application ?
Thanks for the reply.
I also tried Fixed QSizePolicy:
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT);
I got the same result.
And I need to fix the size of the window itself. Even if that mean hiding some buttons. Like this:
http://i90.photobucket.com/albums/k274/alaa_137/Screenshot from 2015-12-21 113820_zpskxpktac4.png
I need my layout to look as in this picture. As you can see here, Button 4 is hidden. I need it to be shown only when it gets focus (maybe I need to make my layout scrollable)
Use a QScrollArea
Where are you setting the fixed size ?
QScrollArea along with
Why set the stacked widget geometry ? Shouldn't the scroll area be enough ?
AlaaM last edited by
Just tried to remove that and the screen didn't look as I wanted. Maybe it's because not all my screens are