Skip to content

Commit

Permalink
Highlight default editor in "Edit As" context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dgelessus committed Mar 9, 2024
1 parent 28482df commit fcab61f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/PrpShop/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,20 @@ void PrpShopMain::treeContextMenu(const QPoint& pos)
editAsMenu->setEnabled(false);
for (short type : pqGetValidKOTypes()) {
if (item->obj()->ClassInstance(type)) {
if (type != item->obj()->ClassIndex()) {
// Enable the Edit As submenu only if it has at least one "interesting" entry,
// i. e. not just the default editor.
editAsMenu->setEnabled(true);
}
editAsMenu->addAction(
QAction* action = editAsMenu->addAction(
pqGetTypeIcon(type),
pqGetFriendlyClassName(type),
[this, item, type]() {
editCreatable(item->obj(), type);
}
);
if (type == item->obj()->ClassIndex()) {
editAsMenu->setDefaultAction(action);
} else {
// Enable the Edit As submenu only if it has at least one "interesting" entry,
// i. e. not just the default editor.
editAsMenu->setEnabled(true);
}
}
}
menu.addAction(fActions[kTreeEditHex]);
Expand Down

0 comments on commit fcab61f

Please sign in to comment.