Old connect syntax

Before Qt 5, the old connect syntax was the only option. It looks as follows:

connect(spinBox, SIGNAL(valueChanged(int)),
        dial,    SLOT(setValue(int)));

This statement establishes a connection between the signal of the spinBox object called valueChanged that carries an int parameter and a setValue slot in the dial object that accepts an int parameter. It is forbidden to put argument names or values in a connect statement. Qt Creator is usually able to suggest all possible inputs in this context if you press Ctrl + Space after SIGNAL( or SLOT(.

While this syntax is still available, we discourage its wide use, because it has the following drawbacks:

  • If the signal or the slot is incorrectly referenced (for example, its name ...

Get Game Programming using Qt 5 Beginner's Guide - 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.