Book Image

Hands-On Mobile and Embedded Development with Qt 5

By : Lorn Potter
Book Image

Hands-On Mobile and Embedded Development with Qt 5

By: Lorn Potter

Overview of this book

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.
Table of Contents (23 chapters)
Title Page
Dedication
About Packt
Foreword
Contributors
Preface
Index

Preface

Qt is everywhere these days. From your typical home computer to cloud servers, mobile phones, machine automation, coffee machines, medical devices, and embedded devices of all kinds, even in some of the classiest automobiles. It might even be somewhere in space, too! Even watches run Qt these days.

The Internet of Things (IoT) and home automation are big buzzwords that Qt is also a part of. As I like to say, there's no IoT without sensors! Would I write a book on Qt development without mentioning sensors? No. So, we will also dive into Qt Sensors as well.

There's no shortage of target devices these days, that's for sure. But in this book, we will only specifically target mobile phone platforms and Raspberry Pi to demonstrate some of the embedded features of Qt. Because Qt is cross-platform, you should still come away with knowledge on how to target coffee makers, too!

One consideration to make is which UI framework is going to be used. Using OpenGL is a viable option for mobile devices, especially if there is hardware support. I deliberately skip discussing OpenGL, as that is quite complicated and would be a complete book in itself. It is an option, however, and is available through the use of Qt frameworks.

Who this book is for

This book is aimed at developers who are interested in developing cross-platform applications with Qt for use on mobile and embedded devices. Readers should have prior knowledge of C++ and be familiar, running commands from a command-line interface.

What this book covers

Chapter 1, Standard Qt Widgets, covers standard UI elements and dynamic layouts to teach the reader how to handle orientation changes.

Chapter 2, Fluid UI with Qt Quick, outlines standard QML elements, charts, data visualization, and animation.

Chapter 3, Graphical and Special Effects, looks at QML particles and graphical effects.

 

Chapter 4, Input and Touch, teaches the readers how to create and use virtual keyboards, and touch and voice input.

Chapter 5, Qt Network for Communication, talks the reader through network operations, sockets, and sessions.

Chapter 6, Connectivity with Qt Bluetooth LE, goes over Bluetooth LE device discovery, setting up a service, and manipulating characteristics.

Chapter 7, Machines Talking, discusses sensors, WebSockets, and MQTT automation.

Chapter 8, Where Am I? Location and Positioning, looks at GPS location, positioning, and maps.

Chapter 9, Sounds and Visions – Qt Multimedia, covers 3D audio, FM radio, and recording and playing video.

Chapter 10, Remote Databases with Qt SQL, outlines, remote use of SQLite and MySQL databases.

Chapter 11, Enabling In-App Purchases with Qt Purchasing, discusses adding in-app purchases to your apps.

Chapter 12Cross Compiling and Remote Debugging, looks at cross-compiling, and connecting to and debugging on a remote device.

Chapter 13Deploying to Mobile and Embedded, examines the setting up of an application and completion of app store procedures.

Chapter 14, Universal Platform for Mobiles and Embedded Devices, looks at running Qt apps in a web browser.

Chapter 15, Building a Linux System, covers setting up and building a complete Linux embedded system.

To get the most out of this book

This book assumes you have used C++, are familiar with QML, can use Git to download source code, and can type commands into a command-line interface. You should also be accustomed to using GDB debugger.

It also assumes you have a mobile or embedded device, such as a phone or Raspberry Pi.

 

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Mobile-and-Embedded-Development-with-Qt-5/tree/master. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789614817_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "On iOS, you need to edit the plist.info file."

A block of code is set as follows:

if (!QTouchScreen::devices().isEmpty()) {
   qApp->setStyleSheet("QButton {padding: 10px;}");
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select the Projects icon on the left side of Qt Creator, then pick which target platform you want like Qt 5.12.0for iOS"

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.