Hi,
I have connected and signal to another signal and it to a slot.
Here is how I am using it but the slot is never called.
TextFileImporter
*importer
= new TextFileImporter
(cDetails,
(QWidget *)parent
());
connect(importer,SIGNAL(importDone()),this,SIGNAL(importDone()));
TextFileImporter *importer = new TextFileImporter(cDetails,(QWidget *)parent());
connect(importer,SIGNAL(importDone()),this,SIGNAL(importDone()));
To copy to clipboard, switch view to plain text mode
Import importer(contactDetails,this);
connect(&importer,SIGNAL(importDone()),this,SLOT(importDone()));
Import importer(contactDetails,this);
connect(&importer,SIGNAL(importDone()),this,SLOT(importDone()));
To copy to clipboard, switch view to plain text mode
THE SLOT
void AppWindow::importDone()
{
//This slot is never called
}
void AppWindow::importDone()
{
//This slot is never called
}
To copy to clipboard, switch view to plain text mode
The place where signal is emitted
void TextFileImporter::importAll()
{
qApp
->setOverrideCursor
(QCursor(Qt
::WaitCursor));
hide();
dataTable->blockSignals(true);
//import code here
emit importDone();
dataTable->blockSignals(false);
show();
qApp->restoreOverrideCursor();
}
void TextFileImporter::importAll()
{
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
hide();
dataTable->blockSignals(true);
//import code here
emit importDone();
dataTable->blockSignals(false);
show();
qApp->restoreOverrideCursor();
}
To copy to clipboard, switch view to plain text mode
I have no idea why the slot is not called. I tried looking into the moc file and here is what I found
moc_import.cpp
// SIGNAL 0
void Import::importDone()
{
}
// SIGNAL 0
void Import::importDone()
{
QMetaObject::activate(this, &staticMetaObject, 0, 0);
}
To copy to clipboard, switch view to plain text mode
moc_textfileimporter.cpp
// SIGNAL 0
void TextFileImporter::importDone()
{
}
// SIGNAL 0
void TextFileImporter::importDone()
{
QMetaObject::activate(this, &staticMetaObject, 0, 0);
}
To copy to clipboard, switch view to plain text mode
moc_appwindow.cpp
int AppWindow
::qt_metacall(QMetaObject::Call _c,
int _id,
void **_a
) {
if (_id < 0)
return _id;
switch (_id) {
case 0:
....
....
case 65: importDone(); break;
}
_id -= 66;
}
return _id;
}
int AppWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0:
....
....
case 65: importDone(); break;
}
_id -= 66;
}
return _id;
}
To copy to clipboard, switch view to plain text mode
Can someone please tell me what's wrong?
Thanks a lot!
Bookmarks