Gui: extend Workbench class to allow to define permanent menu items

This commit is contained in:
wmayer
2022-02-14 16:47:32 +01:00
parent 024bde641c
commit 07200f9260
4 changed files with 61 additions and 0 deletions

View File

@@ -84,6 +84,23 @@ MenuItem* MenuItem::findItem(const std::string& name)
return 0;
}
MenuItem* MenuItem::findParentOf(const std::string& name)
{
for (QList<MenuItem*>::Iterator it = _items.begin(); it != _items.end(); ++it)
{
if ((*it)->_name == name)
return this;
}
for (QList<MenuItem*>::Iterator it = _items.begin(); it != _items.end(); ++it)
{
if ((*it)->findParentOf(name))
return *it;
}
return nullptr;
}
MenuItem* MenuItem::copy() const
{
MenuItem* root = new MenuItem;