O'Reilly logo

An Introduction to Design Patterns in C++ with Qt 4 by Paul Ezust, Alan Ezust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Concurrency

QProcess and QThread provide two approaches to concurrency. We discuss how to create and communicate with processes and threads, as well as techniques for monitoring and debugging them.

12.1

QProcess and Process Control

278

12.2

Threads and QThread

290

12.3

Summary: QProcess and QThread

303

QProcess and Process Control

QProcess is a very convenient (and cross-platform) class for starting and controlling other processes. It is derived from QObject and takes full advantage of signals and slots to make it easier to “hook up” with other Qt classes.

We discuss now a simple example that starts a process and views its continually running output. Example 12.1 shows the definition of a simple class derived from QProcess.[1]

Example 12.1. src/logtail/logtail.h ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required