PDA

View Full Version : Two UI files, one header/CPP - is it possible?



LostSoul
23rd April 2015, 17:10
Dear all,

I have an question regarding resizing the window as I have to provide my app for a desktop or laptop user. The app is a rebuild of an app built in India but with a lot of modifications (and different programming language). The layout in the original app is not resize friendly and this is mostly a copy, but I am aware that I may need to spend time and make it layout (ie, resize) friendly.

My application only requires two sizes: desktop or laptop - nothing in between. Unfortunately the laptops connect to desktop monitors at work and users would then want a full screen app, so an initial idea of creating two apps is no good.

My question for all you good people is this:
Is there a way that I can use two UI files with one Header/CPP file, with the ability to swap between them depending on what screen resolution is detected when each UI file is loaded? Everything on both UI files will be identical except for the layouts, as one will be laptop friendly.

I have seen the QtUiTools module and this could possibly be my solution, although I would probably have to change some code to accomodate this (I haven't looked too closely yet), so if it is possible with the UI's compiled into the program this would be better.

I am only at the exploring stage while I build the app for the desktop but I am thinking this is not possible. Can you advise? How do people handle this type of situation?

Regards,

wysota
23rd April 2015, 17:24
You have the whole expressiveness of C++ at hand, including inheritance. Have a base class defining the logic of the application and two subclasses providing two version of the user interface. Then you will be able to decide which UI to show by instantiating one or the other.