Hands-On Mobile and Embedded Development with Qt 5
eBook - ePub

Hands-On Mobile and Embedded Development with Qt 5

Build apps for Android, iOS, and Raspberry Pi with C++ and Qt

  1. 368 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Hands-On Mobile and Embedded Development with Qt 5

Build apps for Android, iOS, and Raspberry Pi with C++ and Qt

About this book

Explore Qt framework and APIs for building cross-platform applications for mobile devices, embedded systems, and IoT

Key Features

  • 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

Book 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.

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

Who this book is 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.

Trusted by 375,005 students

Access to over 1.5 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2019
Print ISBN
9781789614817
Edition
1
eBook ISBN
9781789618488

Section 1: Making Great UIs

Qt provides several ways for a developer to create great looking applications, from the more standard looking Qt Widgets to Qt Quick, with its endlessly creative fluid animation and sparkling effects, to Qt OpenGL, which brings immersive gaming into the Qt mobile world. In this section readers will learn how to use Qt's various UI frameworks to create dynamic and flexible user interfaces for mobile and embedded devices, targeting platforms, such as iOS, Android for mobile, and the Raspberry Pi.
This section comprises of the following chapters:
  • Chapter 1, Standard Qt Widgets
  • Chapter 2, Fluid UI with Qt Quick
  • Chapter 3, Graphical and Special Effects
  • Chapter 4, Input and Touch

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 Qt Widgets to create a mobile app and run on the device
  • Differences between desktop and mobile apps including screen size, memory, gestures
  • Using Qt Widgets in dynamic layouts for easy screen size and orientation changes
  • Using QGraphicsView for graphical apps

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 apps run on TVs and you can even see them running on entertainment systems in cars and planes. It runs on medical devices as well as industrial automation machines on factory floors.
There are considerations for using Qt on mobile and embedded devices such as memory constraints and display size constraints. Mobiles have touchscreens, and embedded devices might not have screens at all.
When you install Qt, you can use the Qt Creator IDE to edit, build and run your code. It's free and open source, so you can even customize it. I once had a patch that customized Qt Creator in a way that would allow me to print out all the keyboard commands that is was using, so I could have a quick reference sheet. Let's take a quick look at Qt Creator, that was once known as Workbench.

Qt Creator

We are not going to go into any great detail about Qt Creator, but I thought I should mention it to demonstrate how we could go about using it to develop a cross-platform QWidget based application that runs on a desktop and mobile platform. Some differences between the two will be discussed. We'll then demonstrate how using dynamic layouts can help you target many different screen sizes and handle device orientation changes. You might already be familiar with Qt Creator, so we will refresh your memory.

Basic Qt Creator procedure

The basic procedure for cross-compiling and building apps that run on a mobile device are straight forward after you get set up. The procedure that we would hypothetically follow is:
  1. File | New File or Project... | Qt Widgets Application, click the Choose... button
  2. Write some amazing code
  3. Select the Projects icon on the left side of Qt Creator, then pick which target platform you want like Qt 5.12.0 for iOS
  4. Hit Ctrl + B, or Command + B ...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Foreword
  6. Contributors
  7. Preface
  8. Section 1: Making Great UIs
  9. Standard Qt Widgets
  10. Fluid UI with Qt Quick
  11. Graphical and Special Effects
  12. Input and Touch
  13. Section 2: Networking, Connectivity, Sensors, and Automation
  14. Qt Network for Communication
  15. Connectivity with Qt Bluetooth LE
  16. Machines Talking
  17. Where Am I? Location and Positioning
  18. Section 3: Other APIs Qt SQL, Qt Multimedia, and Qt Purchasing
  19. Sounds and Visions - Qt Multimedia
  20. Remote Databases with Qt SQL
  21. Enabling In-App Purchases with Qt Purchasing
  22. Section 4: Mobile Deployment and Device Creation
  23. Cross Compiling and Remote Debugging
  24. Deploying to Mobile and Embedded
  25. Universal Platform for Mobiles and Embedded Devices
  26. Building a Linux System
  27. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.5M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1.5 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Hands-On Mobile and Embedded Development with Qt 5 by Lorn Potter in PDF and/or ePUB format, as well as other popular books in Computer Science & Entreprise Applications. We have over 1.5 million books available in our catalogue for you to explore.