diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-10-12 16:03:12 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-10-12 14:32:55 +0000 |
commit | 7ec2fd482ed9a1385b68e1efd9cfd7c6a889eb80 (patch) | |
tree | 962bb2c8b6112bd7c6425501a4358dca840f7fad /src/plugins/qmldesigner/components | |
parent | 9e064b158eff2dff4a0cb6ebf7b7e52bf4ddd86c (diff) |
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>
Diffstat (limited to 'src/plugins/qmldesigner/components')
-rw-r--r-- | src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 2d9c19279c..96d08e5bae 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -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, |