forked from qt-creator/qt-creator
QmlDesigner: Show anchors menu only if applicable
Change-Id: I09e6e14f96b62b561027694ebc5a73b51c6ab8d8 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -574,11 +574,6 @@ bool multiSelection(const SelectionContext &context)
|
||||
return !singleSelection(context) && selectionNotEmpty(context);
|
||||
}
|
||||
|
||||
bool singleSelectionAndInBaseState(const SelectionContext &context)
|
||||
{
|
||||
return singleSelection(context) && inBaseState(context);
|
||||
}
|
||||
|
||||
bool multiSelectionAndInBaseState(const SelectionContext &context)
|
||||
{
|
||||
return multiSelection(context) && inBaseState(context);
|
||||
@@ -887,6 +882,12 @@ bool raiseAvailable(const SelectionContext &selectionState)
|
||||
return parentProperty.indexOf(modelNode) < parentProperty.count() - 1;
|
||||
}
|
||||
|
||||
bool anchorsMenuEnabled(const SelectionContext &context)
|
||||
{
|
||||
return singleSelectionItemIsNotAnchoredAndSingleSelectionNotRoot(context)
|
||||
|| singleSelectionItemIsAnchored(context);
|
||||
}
|
||||
|
||||
void DesignerActionManager::createDefaultDesignerActions()
|
||||
{
|
||||
using namespace SelectionContextFunctors;
|
||||
@@ -1001,11 +1002,10 @@ void DesignerActionManager::createDefaultDesignerActions()
|
||||
&setVisible,
|
||||
&singleSelectedItem));
|
||||
|
||||
addDesignerAction(new ActionGroup(
|
||||
anchorsCategoryDisplayName,
|
||||
anchorsCategory,
|
||||
priorityAnchorsCategory,
|
||||
&singleSelectionAndInBaseState));
|
||||
addDesignerAction(new ActionGroup(anchorsCategoryDisplayName,
|
||||
anchorsCategory,
|
||||
priorityAnchorsCategory,
|
||||
&anchorsMenuEnabled));
|
||||
|
||||
addDesignerAction(new ModelNodeAction(
|
||||
anchorsFillCommandId,
|
||||
|
Reference in New Issue
Block a user