user896036
user896036

Reputation: 509

Connecting a setValue slot of a custom slider so that it is called when changing the value in QSpinBox?

I am creating a custom slider class using QAbstractSlider as base class. In the main function I have tried connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))) but it is not working.

Upvotes: 0

Views: 555

Answers (1)

pnezis
pnezis

Reputation: 12321

The connection should work.

Make sure that you have used the Q_OBJECT macro in your class definition. Also in the main.cpp do the following:

Add the following include:

#include <QErrorMessage>

and add the following line of code

QErrorMessage::qtHandler();

If there is any problem with Singal /Slot connections a qt dialog will popup.

Upvotes: 2

Related Questions