Main Window resizing
-
I developed my application interface using QT. I have different QWidget in my interface.
How can I set it fit in different screen sizes? -
-
May be just use showMaximized() the main widget (or MainWindow), it will fit to the screen (any screen size)
-
Thanks Santosh for your reply.
I have two screen one in landscape mode and other in portrait mode.
showMaximized() works for landscape screen, however, layout is destroyed on the portrait screen.
How can I tackle these varying size and orientation screen issues? -
It is not possible to have same layout in both, in most cases applications with such requirements end up implementing different layout for landscape, and a different layout for portrait.
-
Thanks for reply. I appreciate it.
can you elaborate a bit on this point? How will I detect different screen sizes and how will my app switch from one layout to other and vice verse?
I have already grouped my widgets into different horizontal and vertical layout. How will I add different layout to my main window?
-
For this kind of requirement we have QML, since just repositioning widgets doesn't give you a good result.
Either way, what you can do to detect orientation is related to which platform we are talking about, but a simple way is to use QDesktopWidget (via the static method QApplication::desktop()).