Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Hands-On Mobile and Embedded Development with Qt 5
Hands-On Mobile and Embedded Development with Qt 5

Hands-On Mobile and Embedded Development with Qt 5: Build apps for Android, iOS, and Raspberry Pi with C++ and Qt

eBook
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Mobile and Embedded Development with Qt 5

Standard Qt Widgets

Qt Widgets are not the new kid on the block, but they still do have their place in applications that target mobile and embedded devices. They are well formed, predictable and have standard UI elements.

Recognizable UI elements are found in Qt Widgets and work great on laptops, which are simply mobile desktops. In this chapter, you will learn to design standard looking applications. Basic widgets such as menus, icons, and lists will be discussed with an emphasis on how to constrain the user interface to medium and small-sized displays. Topics we will discuss include how to use Qt's dynamic layouts to handle orientation changes. Classes such as QGraphicsScene, QGraphicsView, and QGraphicsItem will be used. Layout API such as QVBoxLayout, QGridLayout, and QStackedLayout will be discussed.

In this chapter we will cover:

  • Using Qt Creator and...

Hello mobile!

So you want to develop apps for mobile and embedded devices using Qt. Excellent choice, as Qt was made for cross-platform development. To get you started, we will run through the basic procedure of using Qt Creator to create, build and run an application. We will briefly examine different aspects to consider when creating mobile and embedded apps, such as how to use Qt Creator to add a menu. Adding a QWidget in the designer is not that difficult, and I will show you how.

Qt has a long history of running on mobile devices, starting with Qt Embedded, which was initially released in 2000. Qt Embedded was the base framework for the UI Qtopia, which was initially released on the Sharp Zaurus on the SL-5000D developer edition.

These days, you can develop an application using Qt and sell it in the iOS App Store, Android Google Play store, or other Linux mobile phones. Qt...

Going smaller, handling screen sizes

Porting applications which were developed for the desktop to run on smaller mobile devices can be a daunting task, depending on the application. Even creating new apps for mobiles, a few considerations need to be made, such as differences in screen resolution, memory constraints, and handling orientation changes. Touch screens add another fantastic way to offer touch gestures and can be challenging due to the differences in the size of a finger as point compared to a mouse pointer. Then there are sensors, GPS and networking to contemplate! 

Screen resolution

As you can see in the previous images in the Add QListView section, the application paradigms are fairly different...

Dynamic layouts

Considering that mobile phones come in all shapes and sizes, it would be ridiculous to need to provide a different package for every different screen resolution. Hence we will use dynamic layouts.

The source code can be found on the Git repository under the Chapter01-layouts directory, in the cp1 branch.

Qt Widgets have support for this using classes such as QVBoxLayout and QGridLayout.

Qt Creator's designer is the easiest way to develop dynamic layouts. Let's go through how we can do that.

To set up a layout, we position a widget on the application form, and press Command or Control on the keyboard while selecting the widgets that we want to put in a layout. Here are two QPushButtons selected for use:

Next, click on the Horizontal Layout icon highlighted here:

You will then see the two widgets enclosed by a thin...

Graphics view

QGraphicsView, QGraphicScene and QGraphicsItem provide a way for applications based on Qt Widgets to show 2D graphics.

The source code can be found on the Git repository under the Chapter01-graphicsview directory, in the cp1 branch.

Every QGraphicsView needs a QGraphicsScene. Every QGraphicsScene needs one or more QGraphicsItem.

QGraphicsItem can be any of the following: 

  • QGraphicsEllipseItem
  • QGraphicsLineItem
  • QGraphicsLineItem
  • QGraphicsPathItem
  • QGraphicsPixmapItem
  • QGraphicsPolygonItem
  • QGraphicsRectItem
  • QGraphicsSimpleTextItem
  • QGraphicsTextItem

Qt Designer has support for adding QGraphicsView . You can follow these steps to do so:

  1. Drag the QGraphicsView to a new application form and fill the form with a QGridLayout like we did before.

  1. Implement a QGraphicsScene in the source code and add it to the QGraphicsView
QGraphicsScene...

Summary

In this chapter we covered some of the issues facing mobile and embedded developers when trying to develop for smaller display devices, and how  QStyleSheets can be used to change the interface at runtime to adapt itself for using touchscreen inputs.

We discussed storage and memory space requirements, and the need to configure unneeded features out of Qt to make it have a smaller footprint.

We went through handling orientation changes and discussed using screen gestures such as Pinch and Swipe.

We learning how to use Qt Designer to add QLayouts to create dynamically resizing applications.

Finally, we discussed how to use QGraphicsView to utilize graphical elements such as graphical text and images.

Next, we will go through the next best thing since sliced bread for mobile and embedded development—Qt Quick and QML. Then we&apos...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build cross-platform applications and deploy them across mobile and connected devices
  • Design 2D and 3D UIs for embedded systems using Yocto and Qt Creator
  • Build machine to machine automation solution using QtSensors, QtMQTT, and QtWebSockets

Description

Qt is a world-class framework, helping you to develop rich graphical user interfaces (GUIs) and multi-platform applications that run on all major desktop platforms and most mobile or embedded platforms. The framework helps you connect the dots across platforms and between online and physical experience. This book will help you leverage the fully-featured Qt framework and its modular cross-platform library classes and intuitive APIs to develop applications for mobile, IoT, and industrial embedded systems. Considerations such as screen size, device orientation changes, and small memory will be discussed. We will focus on various core aspects of embedded and mobile systems, such as connectivity, networking, and sensors; there is no IoT without sensors. You will learn how to quickly design a flexible, fast, and responsive UI that looks great. Going further, you will implement different elements in a matter of minutes and synchronize the UI elements with the 3D assets with high precision. You will learn how to create high-performance embedded systems with 3D/2D user interfaces, and deploy and test on your target hardware. The book will explore several new features, including Qt for WebAssembly. At the end of this book, you will learn about creating a full software stack for embedded Linux systems using Yocto and Boot to Qt for Device Creation.

Who is this book for?

The book is ideal for mobile developers, embedded systems engineers and enthusiasts who are interested in building cross-platform applications with Qt. Prior knowledge of C++ is required.

What you will learn

  • Explore the latest features of Qt, such as preview for Qt for Python and Qt for WebAssembly
  • Create fluid UIs with a dynamic layout for different sized screens
  • Deploy embedded applications on Linux systems using Yocto
  • Design Qt APIs for building applications for embedded and mobile devices
  • Utilize connectivity for networked and machine automated applications
  • Discover effective techniques to apply graphical effects using Qt Quick apps

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 30, 2019
Length: 368 pages
Edition : 1st
Language : English
ISBN-13 : 9781789614817
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Apr 30, 2019
Length: 368 pages
Edition : 1st
Language : English
ISBN-13 : 9781789614817
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 98.97
Qt5 C++ GUI Programming Cookbook
€32.99
Hands-On Mobile and Embedded Development with Qt 5
€32.99
Hands-On Embedded Programming with Qt
€32.99
Total 98.97 Stars icon
Banner background image

Table of Contents

20 Chapters
Section 1: Making Great UIs Chevron down icon Chevron up icon
Standard Qt Widgets Chevron down icon Chevron up icon
Fluid UI with Qt Quick Chevron down icon Chevron up icon
Graphical and Special Effects Chevron down icon Chevron up icon
Input and Touch Chevron down icon Chevron up icon
Section 2: Networking, Connectivity, Sensors, and Automation Chevron down icon Chevron up icon
Qt Network for Communication Chevron down icon Chevron up icon
Connectivity with Qt Bluetooth LE Chevron down icon Chevron up icon
Machines Talking Chevron down icon Chevron up icon
Where Am I? Location and Positioning Chevron down icon Chevron up icon
Section 3: Other APIs Qt SQL, Qt Multimedia, and Qt Purchasing Chevron down icon Chevron up icon
Sounds and Visions - Qt Multimedia Chevron down icon Chevron up icon
Remote Databases with Qt SQL Chevron down icon Chevron up icon
Enabling In-App Purchases with Qt Purchasing Chevron down icon Chevron up icon
Section 4: Mobile Deployment and Device Creation Chevron down icon Chevron up icon
Cross Compiling and Remote Debugging Chevron down icon Chevron up icon
Deploying to Mobile and Embedded Chevron down icon Chevron up icon
Universal Platform for Mobiles and Embedded Devices Chevron down icon Chevron up icon
Building a Linux System Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(2 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Eduardo Hiroshi Nakamura Nov 03, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Interessante as plataformas que o QT roda.
Amazon Verified review Amazon
Maxim Rozhkov Nov 16, 2019
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The most important words in the title are «Hands-on», that means the book gives an opportunity to sneak peek a lot of the Qt 5 features. It covers the most brilliants laying on the basis of the Qt 5, from Qt Quick topics, through gesture control, REST API, Bluetooth and to the Qt for WebAssembly at the end. It can’t give you deep understanding of how Qt works, because of vastness of the Qt World, but after reading you will be much more aware of all those brilliants of the framework. I really loved the book. Only two things prevent the highest score of the book: there are a lot of errors in examples of code and the narrative is a little bit verbose sometimes.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.