LWN.net Logo

Ubuntu's phone SDK and the QML component zoo

By Nathan Willis
January 16, 2013

Canonical unveiled its Ubuntu for phones effort the first week of January with an announcement and a video demonstrating the user interface. For many developers, however, that launch was light on detail, and it was the somewhat less flashy Ubuntu Phone software development kit (SDK) that provided the interesting bits. The SDK highlights QML as the UI toolkit of choice — a fact which has attracted attention from other QML-based projects like KDE's Plasma Active and Jolla's MeeGo derivative Sailfish OS who showed an interest in collaborating on a common API. QML has been the application framework for several free software mobile phone platforms in the past — including some that fizzled out in high-profile fashion; perhaps a collaborative approach is the missing piece.

The Ubuntu Phone SDK

The Ubuntu Phone SDK is provided as a set of .deb packages in a Launchpad Personal Package Archive (PPA), which makes installation a snap for people running Ubuntu or downstream distributions, but a bit of an open question for those running something else. Source is available from Launchpad, but users on RPM-based systems may find satisfying the bleeding-edge dependencies a hassle. The packages include a set of Qt component libraries, plus some demos, examples, and the associated documentation. The development tools are the standard Qt set: the Qt Creator IDE and a QML viewer for interpreting and testing QML code itself.

QML is a JavaScript-based language designed for use in writing application user interfaces. It was introduced in Qt 4.7, coupled with a QtQuick module that defines a basic set of building blocks — graphics primitives like rectangles, gradients, borders, and images; text handling elements like input fields and form validators; animation and transition elements; and an assortment of list, transformation, and state handling elements. Although QML and QtQuick are frequently associated with smartphone development thanks to MeeGo, they are not specific to the mobile space.

The Ubuntu Phone SDK builds on top of the QtQuick base with its own set of components that define application interface elements (such as buttons, tabs, scrollbars, and progress bars), more specific elements for use with lists (such as headers and dividers, and separate elements for those list items that can take one value and those that can include multiple values), and navigation elements geared towards the latest in phone app design trends (such as "sheets" and popovers intended to slide or spring into view and be swiped away by the user).

There is also a separate application theming framework in the SDK, although the documentation warns that it is still under development and subject to change. Currently, theming Ubuntu Phone apps consists of writing a foo.qmltheme file containing CSS-like rules, such as:

    .button {
       color: item.hovered ? "orange" : "#ffcc99";
    }
which are then referenced in a separate file that defines the look of the specific elements used in the app. For example, a Button element would refer to the color above with itemStyle.color and pick up the value #ffcc99. As one would expect of the visually-conscious Canonical, indications are that Ubuntu Phones will ship with a set of pre-defined themes to provide consistency.

Other QML platforms

The theming model is not a big departure from the one used by QtQuick, however. The new QML components defined by the SDK are the principal difference between developing an app for the Ubuntu Phone platform and developing one for any of the other QML-driven platforms. That list includes not only Sailfish and Plasma Active, but RIM's Blackberry Cascades and Nokia's still-alive efforts for its MeeGo Harmattan and Symbian platforms. Each of the other platforms has defined its own set of add-on components as well, a fact that did not escape the attention of mobile developers.

Johan Thelin wrote a blog post on January 3 comparing and contrasting the available add-on toolkits by looking at just one component, the CheckBox element. A checkbox is used to capture a binary selection, but Thelin outlined five properties (text, checked, enabled, pressed, and hovered) and three signal types (onCheckedChanged, onClicked, and onPressAndHold) that vary between the available component libraries. This potentially forces developers to rewrite their applications to support more than one QML-based platform.

For all platforms, one can use the checked property and its onCheckedChanged signal to act. The rest is in up in the air. Ubuntu Phone seems to split the text from the checkbox while the others keep them together. The enabled property is missing from most platforms. Here, even Symbian and Harmattan, both from Nokia, seems to differ.

Nevertheless, Thelin, concluded, "as the concepts seems similar, the work to create a cross-platform set of components wrapping the components of each platform should not be an impossible task."

Canonical's Zoltán Balogh was evidently of similar mind, and popped into the Plasma Active IRC channel on January 9 to discuss the idea with the KDE and Sailfish developers. Subsequently he wrote up the outcome of that discussion on the Qt Components mailing list. Balogh, Marco Martin and Aaron Seigo from KDE, and Joona Petrell from Sailfish agreed to continue discussing QML components and APIs with an eye toward "collect[ing] all concepts in various projects" and a "consistent QML component and common API set." Vladimir Minenko from RIM agreed to participate in the discussion as well, as did several developers from Qt's current corporate backer Digia (who are working on a revised set of components to include in Qt 5.1).

One component set to rule them all?

The discussion on the Qt Components list then turned to the task of collecting information on the various components from each platform that were perceived to be of general interest. The list is growing at the Qt Project wiki, but agreement on the principle of cooperation does not make platform differences melt away.

Digia's Jens Bache-Wiig expressed some skepticism that coordination would reap big benefits, noting that the project had "tried this before with Symbian and Meego and partially failed while spending an amazing amount of time arguing over small issues." Nevertheless, Bache-Wiig was "optimistic that we can find at least some shared ground."

Martin Jones argued for defining a "minimal API" that omitted platform-specific properties and signals, but if the early discussions are anything to judge by, differences between the platforms may make even that task a tricky one. For example, Jens proposed an initial set of components consisting of Button, ToolButton, CheckBox, Slider, ProgressBar, TextField, TextArea, RadioButton, ButtonRow, Menu, ContextMenu, ToolBar, Switch, and BusyIndicator. But Alan Alpert replied that ToolBar, ToolButton, and ContextMenu could not be used in Cascades, because on that platform the system maintains tighter control over UI elements. "You don't create your own tool bar for your application - it creates the system tool bar for your application when you specify actions for it."

To be sure, RIM may have less market share today than it has in years past, but the other platforms differ as well. Martin Jones pointed out that Sailfish has no "tool bar" or "status bar" at all, and so far has no implementation of radio buttons either. Likewise, Canonical's Zsombor Egri replied that Ubuntu Phone has no "tool bar" either and has yet to make a decision about menus and context menus.

Of course, Sailfish and Ubuntu Phone are new platforms not yet running on released products. For that matter, the widely-anticipated Vivaldi tablet project using Plasma Active came to an abrupt halt in mid 2012. All three projects could decide tomorrow that tool bars are indispensable (or, for that matter, that text entry boxes are passé ... ). Still, it is a welcome sight to see the projects collaborating on the process of developing a component API. Seigo wrote approvingly about the discussion on his blog, saying

Not only was everyone "Ok" with this, but consensus was that it was pretty awesome that we have a space for people to come together like this. People even said that to each other rather than let it remain silently unsaid. Contrast that with the attitude we sometimes see in development communities that discourage such "off-topic" communication between "competitors".

Further down in the same post, he hinted that the collaboration may extend beyond QML components to include "other aspects of the bigger puzzle such as common package formats and delivery strategies." The broad view, he concluded, was that sharing some level of API consistency, even if implemented differently behind the scenes, offered "a far more friendly and interesting story for developers."

Few would argue that offering a friendly and interesting developer story is not critical to the success of a new mobile platform. The bigger obstacle may be attracting hardware partners and mobile carriers — a feat that Ubuntu Phone, Plasma Active, and Sailfish all have yet to deliver to completion — but providing a partially-shared development story around QML certainly cannot hurt.

Then again, the promise of a device-neutral application platform is also one of the oft-repeated benefits of using HTML5 as a development platform. Here the Ubuntu Phone marketing materials do not paint as clear of a picture for developers. HTML5 is touted as an option for developing Ubuntu Phone apps, but so far the SDK and tutorials offer no help for HTML5 developers, and the supporting documentation is silent. Perhaps more is still to come (this is the first release of the Ubuntu Phone SDK, after all), or perhaps Canonical is simply waiting to see where its competitors in the mobile HTML5 game — such as Tizen and Firefox OS — head first.


(Log in to post comments)

Ubuntu's phone SDK and the QML component zoo

Posted Jan 17, 2013 4:32 UTC (Thu) by roc (subscriber, #30627) [Link]

I'm biased, but really, what is the point of promoting a QML-based platform for mobile applications? Do people really expect app developers to port en masse to that platform? HTML5 seems far more attractive as a porting target.

HTML5 also has the advantage that we don't have to spend time arguing about how basic form controls should work.

Ubuntu's phone SDK and the QML component zoo

Posted Jan 17, 2013 9:47 UTC (Thu) by khim (subscriber, #9252) [Link]

Do people really expect app developers to port en masse to that platform?

Yes. I'm pretty sure they'll fail, but there is some hope.

HTML5 seems far more attractive as a porting target.

"HTML5-only" is dead end. You can write some applications purely in HTML5, but in the end enough of them require C++ (to reuse existing libraries). Any platform without the ability to reuse C++ code is stillborn.

Ubuntu's phone SDK and the QML component zoo

Posted Jan 17, 2013 10:15 UTC (Thu) by boudewijn (subscriber, #14185) [Link]

Those "basic form controls" are a bit of a red herring. QML is so insanely great because it's so easy to use the same (C++) core and have a small, easy to code and smooth gui on top of that that nicely fits in with the platform.

I mean... Look at Calligra. There are at least five gui's on top of that: the desktop QWidget one, the Harmattan libmeegotouch one and three QML-based gui's: one for meego, one for Plasma Active and then there's Krita Sketch for Windows 8.

QML is awesome, and the more platforms include it, the happier I'll be.

Ubuntu's phone SDK and the QML component zoo

Posted Jan 18, 2013 12:43 UTC (Fri) by neiljerram (subscriber, #12005) [Link]

How much work would it be to make a Calligra UI for QtMoko too, given that QtMoko now supports QML? (I believe.)

Ubuntu's phone SDK and the QML component zoo

Posted Jan 18, 2013 14:45 UTC (Fri) by boudewijn (subscriber, #14185) [Link]

If QML is there, that means that most of Qt should be around. Then it depends on whether the kde framework libraries exist already -- they might take a bit of porting. dbus support can be hacked out, that's not a big issue if it doesn't exist. Otherwise it should be really plain sailing.

If there are weird things like shared library limitations (like on Android) or process size limitations, that could be a big barrier. We fixed those for Android, though.

One platform to rule them all

Posted Jan 17, 2013 15:08 UTC (Thu) by man_ls (subscriber, #15091) [Link]

I guess that with time QML might be ported to iOS, Windows Mobile, Blackberry and perhaps even to Android. So your application might run on several mobile platforms with minor changes.

In practice, only iOS and Android matter at this point. I would wait to see QML ported before taking the plunge. Even so, the continuity of QML and Qt in general is a big unknown (I don't know much about Digia so I assume most people are in the same situation).

Betting on QML or HTML5 are risky propositions at this point in time.

One platform to rule them all

Posted Jan 17, 2013 18:32 UTC (Thu) by jospoortvliet (subscriber, #33164) [Link]

Parts to all those platforms* are in various stages of completion and the continuity questions about Qt and QML are answered by now - Digia has shown to invest and set new directions while playing well with the growing community of other companies contributing under the 'Open Governance' umbrello so I wouldn't worry about that.

* With windows Mobile I assume you mean Windows Phone, Windows Mobile has had Qt available for it since the stone age. With Blackberry, the new Blackberry platform is build entirely around QML so I'm guessing you'd consider that covered too. For Android, there's a already quite mature port. Heck, there's a porting effort to HTML5/Javascript underway ;-)

One platform to rule them all

Posted Jan 17, 2013 19:53 UTC (Thu) by boudewijn (subscriber, #14185) [Link]

Not sure about QML, but Qt is already available on iOS (as well as OSX, of course) And QML isn't just about tablets and phones, it's awesome on the desktop, too, as well as on hybrid things like laptops with touch screens.

One platform to rule them all

Posted Jan 17, 2013 22:22 UTC (Thu) by man_ls (subscriber, #15091) [Link]

Digia has shown to invest and set new directions while playing well with the growing community
Great news! Rereading my message it might look as if I wanted to spread FUD about Qt. Nothing could be farther from the truth: I appreciate the reassurance about Qt's future. It is great to have such a complete toolkit as Free software (and to stay as such).

Indeed, having a mature, Free software toolkit for all mobile platforms would be a big win for developers. The space is ripe for it.

One platform to rule them all

Posted Jan 30, 2013 3:23 UTC (Wed) by buck (subscriber, #55985) [Link]

webkit made it outta KDE land and onto everything

i wouldn't bet against QML either, given its shared legacy,
but honestly not knowing anything else about it

just seems that Qt/KDE is responsible for a lot of stuff
that shows up on people's screens these days

don't know if there is a licensing basis for this or just
technical or aesthetic or what, as previously confessed

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds