Originally Posted by
suneel1310
I was looking for something like below, [I am sure below connection doesn't work, since the sender is NULL]
connect(0, SIGNAL(addText(QString)), this, SLOT(append(QString)));
Yes, that will not work.
But you can do the connection from outside sender and receiver, i.e. in code that has access to both pointers.
connect(sender1, SIGNAL(valueChanged(int)), receiver, SLOT(setNum(int)));
connect(sender2, SIGNAL(valueChanged(int)), receiver, SLOT(setNum(int)));
QLabel *receiver = new QLabel(this);
QSpinBox *sender1 = new QSpinBox(this);
QSlider *sender2 = new QSlider(this);
connect(sender1, SIGNAL(valueChanged(int)), receiver, SLOT(setNum(int)));
connect(sender2, SIGNAL(valueChanged(int)), receiver, SLOT(setNum(int)));
To copy to clipboard, switch view to plain text mode
Two senders of different class, same signal, same receiver and slot.
Cheers,
_
Bookmarks