Single slot, multiple signals

In the next example, we shall connect two signals from different widgets to a single slot. Let's modify our earlier program as follows:

#include <QApplication>#include <QVBoxLayout>#include <QLabel>#include <QDial>#include <QSlider>#include <QLCDNumber>int main(int argc, char *argv[]){   QApplication app(argc, argv);   QWidget *window = new QWidget;   QVBoxLayout *layout = new QVBoxLayout;   QDial *volumeDial= new QDial;   QSlider *lengthSlider = new QSlider(Qt::Horizontal);   QLCDNumber *volumeLCD = new QLCDNumber;   volumeLCD->setPalette(Qt::red);   lengthSlider->setTickPosition(QSlider::TicksAbove);   lengthSlider->setTickInterval(10);   lengthSlider->setSingleStep(1);   lengthSlider->setMinimum(0); lengthSlider->setMaximum(100); ...

Get Getting Started with Qt 5 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.