My ui is desktop dependent,I want it to be desktop resolution independent.
-
I have some group boxes and buttons in the ui.When the window is dragged some part of my ui gets sliced off (i.e screen is not getting compressed ).And when the same project is run on system with smaller resolution some widgets on the edge of the ui dont appear.I want my ui to be desktop resolution independent. I want my ui to compress or extend and "fit to screen" according to the resolution of the pc.Please suggest.
-
I have some group boxes and buttons in the ui.When the window is dragged some part of my ui gets sliced off (i.e screen is not getting compressed ).And when the same project is run on system with smaller resolution some widgets on the edge of the ui dont appear.I want my ui to be desktop resolution independent. I want my ui to compress or extend and "fit to screen" according to the resolution of the pc.Please suggest.
@Sherlin-N-G Use layouts: http://doc.qt.io/qt-5/layout.html
-
@jsulm
hi,
so i have to code from scratch again?Please suggest any alternative if present -
@jsulm
hi,
so i have to code from scratch again?Please suggest any alternative if present@Sherlin-N-G You don't have to code from scratch, why do you think so? Just add layouts and put your widgets into these layouts. There is nothing special about layouts. The only alternative would be to arrange your widgets manually when resizing, but this is much more complex than simply using layouts.
-
@jsulm
Hi,
I tried using layouts I've shared the screen shotIf above is my final form design.Below is my form "sliced-off" when dragged.
I want it to be compressed when dragged not sliced.Please suggest -
@jsulm
Hi,
I tried using layouts I've shared the screen shotIf above is my final form design.Below is my form "sliced-off" when dragged.
I want it to be compressed when dragged not sliced.Please suggest@Sherlin-N-G Well, it looks like you did not do it properly...
Did you read the link I posted?
Did you apply a layout to your main window?
Did you check any layout examples? -
@jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form
-
@jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form
@Sherlin-N-G You really should read documentation/examples.
You apparently forgot to apply a layout to your main window.
And what layout did you use actually?
Can you show the screenshot of your main window in design mode? -
@jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form
@Sherlin-N-G Take a look at this (for Qt 4.8, but it works same way in Qt 5): http://doc.qt.io/archives/qt-4.8/designer-layouts.html
-
@jsulm Below is the screenshot in design mode.
-
@jsulm Below is the screenshot in design mode.
@Sherlin-N-G My assumption was correct: you did not apply a layout to your main window. Think about what you did and why it can't work as expected: you have two layouts containing buttons, line edit and radio button. But these layouts are just laying around on your main window and are not in any layout. So, how would Qt know how you want them to be organized? You need to put them into main window layout. Please read the last link I posted, especially "Setting A Top Level Layout" section.