Which QML trick to use for tablet layout?

asked 2016-06-15 22:53:49 +0300

Fiery gravatar image

updated 2018-12-03 21:33:54 +0300

Tanghus gravatar image

I'm trying to upgrade my ongoing QML project to support the Jolla Tablet. I use a master-detail layout, so user selects an item from a SilicaListView on MainPage.qml, and that will take him/her to DetailPage.qml that has another SilicaListView. I suppose it would be a good method to add a new TabletPage.qml file that would show boths lists on a single page. And then to load either MainPage or TabletPage at startup, depending on the value of Screen.sizeCategory. My problem is: how to avoid managing redundant QML content? E.g. if I have existing QML code in my MainPage and DetailPage, how to keep that code and use them both in phone layout and tablet layout, without keeping two instances of the same QML code? Should I use Loader, or is there a better trick? As far as I can tell, there's no AdaptiveLayout or AdaptiveTrigger in Silica, so I have to manage everything on my own.

Are there any specific resources for developers targeting Jolla Tablet? It's not easy to go by examples, since even the built-in Sailfish OS apps (e.g. Email) do not seem to feature specific layouts for tablets.

edit retag flag offensive close delete

Comments

Check the layout controls of QtQuick; afaik they should have been recently added to MER / or you can compile them yourself and bundle them next to your exe.

tortoisedoc ( 2016-06-16 07:11:25 +0300 )edit

at this point i think you should try something yourself, as really almost none of system apps really use different tablet layouts.

coderus ( 2016-06-16 11:59:24 +0300 )edit

Thank you for your answers!

Fiery ( 2016-06-16 16:35:42 +0300 )edit