QT: Create new connections when signal is emitted
Hello, I would like to create a SLOT that establish some connections between classes. Something like this:
Code:
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?
Re: QT: Create new connections when signal is emitted
Nothing wrong with that code as far as I can see. Do the member variables actually have the values you think they should?
Re: QT: Create new connections when signal is emitted
d_stranz! You are great (and right)!
mDocumentDocklet is (slightly) the wrong class, as I need a subclass. Thanks!