PDA

View Full Version : Detect if window is bigger than screen



qt_developer
5th June 2014, 17:22
Hi all,

Sometimes my window increases the size and it is bigger than screen. How can I restrict the window size to not overflow the width of the screen?

Regards.

d_stranz
5th June 2014, 18:36
In your window constructor, use the QScreen class to determine the screen geometry, and use that to set the window's maximum size. If you are going to do that, you should either derive your window class from QAbstractScrollArea, implement your own scrollbar support, or somehow change the way the window contents are painted to ensure it all stays visible to the user.