ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #00404
Re: [Design] Designing for phone and tablet
On 25/02/13 12:48, Petko wrote:
> <snip>
>
> I'm starting to think that there might be a workaround to implementing
> my solution in the current system . A very very raw example :
> if (device_specs == device_specs_1) define UI_1
> if (device_specs == device_specs_2) define UI_2
> ...
> and so on
>
> I will at some point in the upcoming weeks start playing with QML ,
> and then I'll have a better idea , but now I have to ask - is it
> possible to use an entirely different UI element (or entire UI) when a
> different environment variable is detected (like the example) ?
The way you'd do this with QML is something like this:
MyApp.qml => single master UI file with minimal content that uses a
Loader object to dynamically load either of the two variants below
MyAppContentPhone.qml => master layout file for phones that includes
sub-components
MyAppContentTablet.qml => master layout file for tablets that includes
sub-components
ComponentA.qml
ComponentB.qml
Model.qml
With all the different component files either specific to a particular
form factor or shared between them depending on how you design your app.
And a single model file to ensure the way data is manipulated and saved
is consistent between all form factors. This way you have a single UI
that dynamically decides what to do at runtime based on what device it
runs on.
Bruno
References