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);
|
return !singleSelection(context) && selectionNotEmpty(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool singleSelectionAndInBaseState(const SelectionContext &context)
|
|
||||||
{
|
|
||||||
return singleSelection(context) && inBaseState(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool multiSelectionAndInBaseState(const SelectionContext &context)
|
bool multiSelectionAndInBaseState(const SelectionContext &context)
|
||||||
{
|
{
|
||||||
return multiSelection(context) && inBaseState(context);
|
return multiSelection(context) && inBaseState(context);
|
||||||
@@ -887,6 +882,12 @@ bool raiseAvailable(const SelectionContext &selectionState)
|
|||||||
return parentProperty.indexOf(modelNode) < parentProperty.count() - 1;
|
return parentProperty.indexOf(modelNode) < parentProperty.count() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool anchorsMenuEnabled(const SelectionContext &context)
|
||||||
|
{
|
||||||
|
return singleSelectionItemIsNotAnchoredAndSingleSelectionNotRoot(context)
|
||||||
|
|| singleSelectionItemIsAnchored(context);
|
||||||
|
}
|
||||||
|
|
||||||
void DesignerActionManager::createDefaultDesignerActions()
|
void DesignerActionManager::createDefaultDesignerActions()
|
||||||
{
|
{
|
||||||
using namespace SelectionContextFunctors;
|
using namespace SelectionContextFunctors;
|
||||||
@@ -1001,11 +1002,10 @@ void DesignerActionManager::createDefaultDesignerActions()
|
|||||||
&setVisible,
|
&setVisible,
|
||||||
&singleSelectedItem));
|
&singleSelectedItem));
|
||||||
|
|
||||||
addDesignerAction(new ActionGroup(
|
addDesignerAction(new ActionGroup(anchorsCategoryDisplayName,
|
||||||
anchorsCategoryDisplayName,
|
anchorsCategory,
|
||||||
anchorsCategory,
|
priorityAnchorsCategory,
|
||||||
priorityAnchorsCategory,
|
&anchorsMenuEnabled));
|
||||||
&singleSelectionAndInBaseState));
|
|
||||||
|
|
||||||
addDesignerAction(new ModelNodeAction(
|
addDesignerAction(new ModelNodeAction(
|
||||||
anchorsFillCommandId,
|
anchorsFillCommandId,
|
||||||
|
Reference in New Issue
Block a user