Create mobile apps with Qt Creator

Easy Apps

© Lead Image © Denys Rudyi, 123RF.com

© Lead Image © Denys Rudyi, 123RF.com

Article from Issue 197/2017
Author(s):

Find out how to create a cross-platform app with the veteran tool Qt Creator.

Qt has been around for more than 20 years. During this time, developers have used several approaches to develop graphical interfaces. More specifically, you might recall Qt Widgets [1], Qt Quick [2], and Qt Quick Controls 2 [3]. Qt beginners who want to build mobile, cross-platform apps might perhaps be confused by this diversity, especially since all the technologies are still in use.

Qt runs on different platforms: Desktop, embedded, and mobile. For desktop applications (OS X, Windows, Linux), developers are more likely to go for Qt Widgets, which offers native controls for the user interface. In contrast, Qt Quick, based on an OpenGL implementation, seeks to abstract the UI controls to deploy Qt across platforms. Mobile apps developed with Qt Quick do not look native, nor is their performance very convincing. This changed, however, with Qt 5.7, which introduced the lightweight Qt Quick Controls 2. The name is a bit deceptive, because it is not a new version of Qt Quick, but a completely new development.

Mobile Controls

Qt Quick Controls 2 comes with many additional controls and with new containers that simplify development. Navigation elements, now standard in mobile applications, are also on board. Table 1 shows an overview of the elements provided by Qt Quick Controls 2.

Table 1

Qt Quick Controls 2

Containers

Others

ApplicationWindow (top-level control)

BusyIndicator

ButtonGroup

ComboBox

Container (similar to the Cascades container)

Dial

Frame

Label

GroupBox

PageIndicator

Page (an area with a header and footer)

ProgressBar

Pane (area optimized for selected styles/themes with the correct background)

RangeSlider

Buttons

ScrollBar

Button

Slider

CheckBox

SpinBox

RadioButton

TextArea

Switch

TextField

TabButton

Tumbler

ToolButton

Navigation

Pop-Ups

Drawer

Menu

StackView

Popup (toasts, dialogs)

SwipeView

ToolTip

TabBar

 

ToolBar

Currently, three styles of control elements are available: Google Material, Windows Universal, and Default – a special iOS style is due to follow. Qt also has a dark and a bright theme.

Producers

If you have worked exclusively with Eclipse for more than 10 years, the switch to Qt Creator [4] might not be easy. However, the software is well-suited to building mobile apps. It helps you program the business logic with C++ and create the interface with QML, thus supporting the deployment process on platforms such as Android, iOS, and Windows 10. Developers can test mobile apps on simulators or real devices from within Qt Creator and build releases for the app stores.

Qt Creator supports the complete Android build process with support for an Android Manifest Editor (Figure 1), signatures, and icons. This also works without Android Studio; however, developers do need to install an SDK and the NDK up front.

Figure 1: The Android Manifest Editor in Qt Creator.

An Xcode project for iOS is created by calling Project | Archive and then loading the app into the store, but if you want to use Xcode, you need an Apple computer. The path to the Windows App Store is through a Visual Studio project.

One for All

The beauty of Qt is that it serves different platforms with the same source code, and it even has interfaces to supplement native code for Android and iOS.

For my QtCon Conference App [5], I wanted to find out what is possible with a plain vanilla Qt version. The result is available on GitHub [6], and if you are interested, you will also find it in the Google Play Store or the Apple App Store.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Firefox for Mobile (Fennec)

    Firefox goes mobile – a “desktop” browser in the palm of your hand.

  • Q-DVD-Author

    Authoring video DVDs with Linux was a problem for a long time, but a few useful tools are closing the gap. And Q-DVD-Author gives you a handy front-end for controlling the process.

  • Cinnamon and Mate

    The Cinnamon and Mate desktop systems have stirred up plenty attention around the Linux world. We'll show you around these innovative new desktop systems and help you decide which is right for you.

  • Color Management

    Get a grasp of color management basics and put your knowledge to practical use.

  • Deepin Linux

    Gnome version  3 lost many friends, prompting Linux users to look for alternatives. The elegant and carefully crafted Deepin Linux pushes into the gap with a desktop that feels like a hybrid of Linux, Windows, and Mac  OS.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News