Qt5 C++ GUI Programming Cookbook
上QQ阅读APP看书,第一时间看更新

Introduction

The signals and slots mechanism in Qt 5 is one of its most important features. It's a method that allows communication between objects, which is a crucial part of a program's graphical user interface. A signal can be emitted from any QObject objects or its subclasses, which will then trigger any slot functions of any objects that are connected to the signal. 

Compared to callbacks (which Qt 5 also support), the signals and slots mechanism is comparably more fluid and flexible for the programmer to use. The signals and slots mechanism is both type safe and not strongly coupled to the processing function, which makes it better than the callback's implementation.

A signal of an arbitrary class can trigger any private slots of an unrelated class that is going to be invoked, which is not possible with callbacks.