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();
|
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||||
for (int i = 0; i < commandIds.size(); i++)
|
for (int i = 0; i < commandIds.size(); i++)
|
||||||
{
|
{
|
||||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
if (commandIds[i] == "Separator")
|
||||||
CVF_ASSERT(feature);
|
|
||||||
|
|
||||||
if (feature->canFeatureBeExecuted())
|
|
||||||
{
|
{
|
||||||
QAction* act = commandManager->action(commandIds[i]);
|
menu->addSeparator();
|
||||||
CVF_ASSERT(act);
|
}
|
||||||
|
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
|
QAction* act = commandManager->action(commandIds[i]);
|
||||||
// location of a command ID
|
CVF_ASSERT(act);
|
||||||
if (existingAct == act) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
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