How to do it...

Let's get started by preforming the following steps:

  1. Create a new Qt Widgets Application project. Then, go to File | New File or Project... and create a C++ Class:
  1. After that, name the new class MyWorker and make it inherit from the QObject class. Don't forget to include the QObject class by default as well:
  1. Once you have created the MyWorker class, open up myworker.h and add the following headers at the top:
#include <QObject>#include <QDebug>
  1. After that, add the following signals and slot functions to the file as well: ...

Get Qt5 C++ GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.