PDA

View Full Version : Realization of signal and slot



Blitzor DDD
15th August 2016, 20:01
bh = new BluetoothHandler();
connect(this, &PlayerControl::connectToDevice, bh, &BluetoothHandler::connectToSocket);

void connectToDevice(QBluetoothAddress address);
void BluetoothHandler::connectToSocket(QBluetoothAddres s address);

address is nowhere initialized. I wonder, which address would be after this connect?

anda_skoa
15th August 2016, 21:44
[CODE]
address is nowhere initialized. I wonder, which address would be after this connect?
Well, the place in "this" that emits the signal will have to take care of passing a valid object to the signal when emitting it.

Since QBluetoothAddress is a class, just creating an instance of it will create an initialiized object, so the emit cannot be called without a valid and initialized "address"

Cheers,
_