implemented final connections to allow creating new nodes in the nodeview

This commit is contained in:
itsmattkc
2019-12-13 03:06:12 +11:00
parent 934eea5f40
commit 186973ff20
4 changed files with 44 additions and 3 deletions
+16 -1
View File
@@ -37,7 +37,10 @@ Menu *NodeFactory::CreateMenu()
{
Menu* menu = new Menu();
foreach (Node* n, library_) {
for (int i=0;i<library_.size();i++) {
Node* n = library_.at(i);
// Make sure nodes are up-to-date with the current translation
n->Retranslate();
QStringList path = n->Category().split('/');
@@ -72,12 +75,24 @@ Menu *NodeFactory::CreateMenu()
// Add entry to menu
QAction* a = destination->InsertAlphabetically(n->Name());
a->setData(i);
a->setToolTip(n->Description());
}
return menu;
}
Node* NodeFactory::CreateFromMenuAction(QAction *action)
{
int library_index = action->data().toInt();
if (library_index >= 0 && library_index < library_.size()) {
return library_.at(library_index)->copy();
}
return nullptr;
}
Node *NodeFactory::CreateInternal(const NodeFactory::InternalID &id)
{
switch (id) {