mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1323 Skip separator command when building context menu
This commit is contained in:
parent
ad90d3f38f
commit
bd659c0769
@ -488,22 +488,29 @@ void RimContextCommandBuilder::appendCommandsToMenu(const QStringList& commandId
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
for (int i = 0; i < commandIds.size(); i++)
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
|
||||
if (feature->canFeatureBeExecuted())
|
||||
if (commandIds[i] == "Separator")
|
||||
{
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
menu->addSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
|
||||
for (QAction* existingAct : menu->actions())
|
||||
if (feature->canFeatureBeExecuted())
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
}
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
|
||||
menu->addAction(act);
|
||||
for (QAction* existingAct : menu->actions())
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
}
|
||||
|
||||
menu->addAction(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user