LYN-7189 | Outliner - Disable context menu if right clicking on disabled entity (#4651)

* Don't allow right clicking on a non selectable entity in the Outliner

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Also check that the index is valid to still allow the right click context menu to appear on empty areas of the widget.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Change if check to a more readable bool.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
Danilo Aimini
2021-10-13 13:33:59 -07:00
committed by GitHub
parent 3934ac24e0
commit 3c3cde99be
@@ -553,6 +553,13 @@ namespace AzToolsFramework
return;
}
// Do not display the context menu if the item under the mouse cursor is not selectable.
if (const QModelIndex& index = m_gui->m_objectTree->indexAt(pos); index.isValid()
&& (index.flags() & Qt::ItemIsSelectable) == 0)
{
return;
}
QMenu* contextMenu = new QMenu(this);
// Populate global context menu.