Why would two UI files be needed? If the form uses a grid layout without using horizontal or vertical spacers, then the layout should just expand to fill the form rectangle when the form is resized to fit the display. As ChrisW67 said, you need to use QDesktopWidget to find the screen dimensions and then resize you own widget to fit.

When designing the form, you have to take screen dimensions into account - you can't make the child widgets too wide to fit side-by-side on a portrait screen, and you can't make them too tall to fit on a landscape screen.

The spacing that the grid layout produces may not be very satisfactory from a visual point of view - in portrait mode, all the widgets will spread out vertically, while in landscape mode, they'll have a lot of horizontal space between them.