LucaDanieli
5th February 2017, 16:32
Hello, I would like to create a SLOT that establish some connections between classes. Something like this:
void MainWindow::onDocumentDockletUndocked( bool isFloating )
{
if(isFloating) {
foreach(MultiEditor * me, mEditorList) {
connect(me, SIGNAL(currentDocumentChanged(Document*)),
mDocumentsDocklet, SLOT(setCurrent(Document*)));
}
} else {
foreach(MultiEditor * me, mEditorList) {
disconnect(me, SIGNAL(currentDocumentChanged(Document*)),
mDocumentsDocklet, SLOT(setCurrent(Document*)));
}
}
}
This specific example isn't working (though the same works perfectly in a different context).
So I was wondering: can I established or remove connections on the fly as above?
void MainWindow::onDocumentDockletUndocked( bool isFloating )
{
if(isFloating) {
foreach(MultiEditor * me, mEditorList) {
connect(me, SIGNAL(currentDocumentChanged(Document*)),
mDocumentsDocklet, SLOT(setCurrent(Document*)));
}
} else {
foreach(MultiEditor * me, mEditorList) {
disconnect(me, SIGNAL(currentDocumentChanged(Document*)),
mDocumentsDocklet, SLOT(setCurrent(Document*)));
}
}
}
This specific example isn't working (though the same works perfectly in a different context).
So I was wondering: can I established or remove connections on the fly as above?