Gui: Simplify QObject::connect in openPopupMenu
Co-authored-by: xtemp09 <9303235+xtemp09@users.noreply.github.com>
This commit is contained in:
@@ -2149,29 +2149,26 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
contextMenu->insertSeparator(posAction);
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
contextMenu,
|
||||
&QMenu::triggered,
|
||||
contextMenu,
|
||||
[this, navMenuGroup, pickAction](QAction* selectedAction) {
|
||||
// handle navigation style change if user selected a navigation style option
|
||||
if (selectedAction && isNavigationStyleAction(selectedAction, navMenuGroup)) {
|
||||
applyNavigationStyleChange(selectedAction);
|
||||
rightClickPosition.reset();
|
||||
return;
|
||||
}
|
||||
auto navigationFunction = [this, navMenuGroup](QAction* selectedAction) {
|
||||
// handle navigation style change if user selected a navigation style option
|
||||
if (isNavigationStyleAction(selectedAction, navMenuGroup)) {
|
||||
applyNavigationStyleChange(selectedAction);
|
||||
rightClickPosition.reset();
|
||||
}
|
||||
};
|
||||
|
||||
if (pickAction && selectedAction == pickAction) {
|
||||
// Execute the Clarify Selection command at this position
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName(
|
||||
"Std_ClarifySelection"
|
||||
);
|
||||
if (cmd && cmd->isActive()) {
|
||||
cmd->invoke(0); // required placeholder value - we don't use group command
|
||||
}
|
||||
auto clarifyFunction = [pickAction](QAction* selectedAction) {
|
||||
if (selectedAction == pickAction) {
|
||||
// Execute the Clarify Selection command at this position
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName("Std_ClarifySelection");
|
||||
if (cmd && cmd->isActive()) {
|
||||
cmd->invoke(0); // required placeholder value - we don't use group command
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
QObject::connect(contextMenu, &QMenu::triggered, navigationFunction);
|
||||
QObject::connect(contextMenu, &QMenu::triggered, clarifyFunction);
|
||||
|
||||
contextMenu->popup(QCursor::pos());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user