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*)));
}
}
}
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*)));
}
}
}
To copy to clipboard, switch view to plain text mode
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?
Bookmarks