Book Image

Hands-On Embedded Programming with Qt

By : John Werner
Book Image

Hands-On Embedded Programming with Qt

By: John Werner

Overview of this book

Qt is an open source toolkit suitable for cross-platform and embedded application development. This book uses inductive teaching to help you learn how to create applications for embedded and Internet of Things (IoT) devices with Qt 5. You’ll start by learning to develop your very first application with Qt. Next, you’ll build on the first application by understanding new concepts through hands-on projects and written text. Each project will introduce new features that will help you transform your basic first project into a connected IoT application running on embedded hardware. In addition to gaining practical experience in developing an embedded Qt project, you will also gain valuable insights into best practices for Qt development and explore advanced techniques for testing, debugging, and monitoring the performance of Qt applications. The examples and projects covered throughout the book can be run both locally and on an embedded platform. By the end of this book, you will have the skills you need to use Qt 5 to confidently develop modern embedded applications.
Table of Contents (22 chapters)
Free Chapter
1
Section 1: Getting Started with Embedded Qt
5
Section 2: Working with Embedded Qt
10
Section 3: Deep Dive into Embedded Qt
14
Section 4: Advanced Techniques and Best Practices
Appendix A: BigProject Requirements

To get the most out of this book

The reader is expected to have basic knowledge of C++. While some knowledge of C++11 is helpful, new features are explained when we come to them. You should also have experience with using Linux shell commands. You will also want to get an embedded target. For this book, we will be using a Raspberry Pi 3B+ with a couple of extra pieces of hardware. The details can be found in Chapter 1, Setting Up the Environment. However, you can work through most of the first two chapters without having the hardware!

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-Embedded-Programming-with-Qt. 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

Code in Action

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: "Because we are using a Raspberry Pi 3B+, you will want to use the qt-raspberrypi3-2gb.img.xz file."

A block of code is set as follows:

void MainWindow::on_pushButton_clicked()
{
QString name = ui->lineEdit->selectedText();
ui->label->setText(QString("Nice to meet you %1!").arg(name));
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// find the sensor and start it
m_sensor = new QAmbientTemperatureSensor(this);
m_connected = m_sensor->connectToBackend();
m_sensor->start();

Any command-line input or output is written as follows:

[On Host]$ # fetch the code
[On Host]$ cd ~/raspi
[On Host]$ git clone https://code.qt.io/qt/qtknx.git
[On Host]$ cd qtknx/

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "You can always jump back to the Welcome screen by hitting the Welcome icon at the top of the left-hand icon menu."

Warnings or important notes appear like this.
Tips and tricks appear like this.