
Originally Posted by
Michiel
I don't think tricking the signal/slot system is the answer.
I'm not tricking it, I just moved the location of the call to connect(). Docs for connectNotify() say "Warning: This function violates the object-oriented principle of modularity." which seems more like tricking it.

Originally Posted by
Michiel
Every drag/drop, I would save a stringifiable (meaning: able to be stringified) representation of the new higher-level connection as well as connect the signal and slot.
Thats exactly what I did. The following function is called for every drop, if accpeted, and is also used to restore connections.
QMultiMap<QString, QString> connections;
void Core::connectChannels(Channel* sender, Channel* receiver)
{
connections.insert(sender->getModName() + "|" + sender->getName(), receiver->getModName() + "|" + receiver->getName());
connect(sender,
SIGNAL( Output
(QString) ), receiver,
SLOT( Input
(QString) ));
}
QMultiMap<QString, QString> connections;
void Core::connectChannels(Channel* sender, Channel* receiver)
{
connections.insert(sender->getModName() + "|" + sender->getName(), receiver->getModName() + "|" + receiver->getName());
connect(sender, SIGNAL( Output(QString) ), receiver, SLOT( Input(QString) ));
}
To copy to clipboard, switch view to plain text mode
This does require every object to have a unique name, but that doesn't seem unreasonable. To save the list, I just iterate through connections and pass the strings to QSettings(). To restore connections, I have search functions that return pointers to the channel by seraching on the ModName and Channel Name.
The Core class is what loads the plugins, and restores their state, and has the lists of objects that can be connected. So it seems like the best place to handle the connections.
Bookmarks