I am reading C++-GUI-Programming-with-Qt-4-1st-ed.pdf and trying to modify the code to see how far I can take each lesson.
I want a message window to popup when ten spinbox hits 23. Code in bold is mine.
Here is base code
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QWidget *window = new QWidget;
window->setWindowTitle("Enter Your Age");

QSpinBox *spinBox = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);

QLabel *messagel = new QLabel("You are 23 !");

spinBox->setRange(0, 130);
slider->setRange(0, 130);
QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
spinBox->setValue(35);

QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();

}

I tried everything.... I tried something like this:

QObject::connect(spinbox, SIGNAL(setValue(int)), message, SLOT(setValue(int)));
or
QObject::connect(spinbox, SIGNAL(setValue(int)), message, SLOT(message->display()));
or
if (spinbox->value()==23)
{ message->display()}

It displays the message but not when the slider or spinbox hits 23 .
Can someone show me the code to insert to make it work ?