Selective UI based on device
I need to develop qt application for various models of devices, they differ mainly in screen size, resolution and color depth and layout (landscape/portrait) only.
I need to have my application to adapt the UI according to device capabilities, I can create different ui files for each models and keep the backend same.
My Question, is how can I make my application load ui, provided I can get the device model no: on runtime.
Thanks in advance.
are you also looking at QML to be used as the UI for your device(s)
I am using qt-4.5.3 and Qt designer for developing the UI.
QML is then ruled out.
Looks like you are trying to bundle all the different UIs into your application and at runtime you want to use the correct one. But won't you be bloating your installable needlessly?
Maybe you can seek to have a single UI that smartly arranges the components based on the orientation, by using correct layouts. The app could be opened in fullscreen mode.
you can look at QSystemDisplayInfo to get color depth and other details of the device
You might want to look at http://doc.qt.nokia.com/latest/designer-using-a-ui-file.html#run-time-form-processing for selecting the .ui file runtime.
Yes, the installable will be huge, but the trick here is that,the front end is developed by 3rd party who knows little programming, so we advice them to use designer to create the layouts as they wish for each model.
Else we need to take their UI files and arrange the widget programatically, which cause double effort.
The class "QUiLoader ":http://doc.qt.nokia.com//4.7/quiloader.html might be what you are lokking for.