[Solved] Signal and Slot not connecting for some reason
-
-
The deliverFaultCode slot returns a string that contains the text for the description of the fault code. Since I didn't think a slot could "return" anything, I used a QString * to be able to look at the value that was set in the deliverFaultCode slot.
-
I added the Q_ASSERT(ok) and don't see any warning message in my application output.
-
-
I call the emit when I populate a QTableWidget. The rest of the table's being populated, so the emit is definitely being called:
@
faultEntry[index].faultDate = new QTableWidgetItem();
faultEntry[index].faultDate->setText(fault[skipLines].dateString);
faultEntry[index].faultDate->setTextAlignment(Qt::AlignCenter);
logTable->setItem(index, 0, faultEntry[index].faultDate);
faultEntry[index].faultTime = new QTableWidgetItem();
faultEntry[index].faultTime->setText(fault[skipLines].timeString);
faultEntry[index].faultTime->setTextAlignment(Qt::AlignCenter);
logTable->setItem(index, 1, faultEntry[index].faultTime);
faultEntry[index].faultCode = new QTableWidgetItem();
faultEntry[index].faultCode->setText(fault[skipLines].codeString);
faultEntry[index].faultCode->setTextAlignment(Qt::AlignCenter);
logTable->setItem(index, 2, faultEntry[index].faultCode);
sysPos = fault[skipLines].codeString.toInt(&ok, 10);
emit requestFaultCode(faultStringPtr, sysPos);
faultEntry[index].faultDesc = new QTableWidgetItem();
faultEntry[index].faultDesc->setText(faultString);
faultEntry[index].faultDesc->setTextAlignment(Qt::AlignCenter);
logTable->setItem(index, 3, faultEntry[index].faultDesc);
@ -
[quote author="Endless" date="1333117644"]1) The deliverFaultCode slot returns a string that contains the text for the description of the fault code. Since I didn't think a slot could "return" anything, I used a QString * to be able to look at the value that was set in the deliverFaultCode slot.
[/quote]True, but using a pointer to return a value is dangerous at best. What happens if there are multiple listeners to the signal? And if there are not/can not be, you might as well use a direct method invokation, which would free you from the issue completely.
[quote]
2) I added the Q_ASSERT(ok) and don't see any warning message in my application output.[/quote][quote author="Endless" date="1333117793"]I call the emit when I populate a QTableWidget. The rest of the table's being populated, so the emit is definitely being called:[/quote]
I guess it is time to fire up your debugger, set a breakpoint at the emit statement, and step into what's going on there...