O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

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

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 ...

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