Commit 7b66a742 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Tim Jenssen

QmlDesigner: Crash fix

Deleting or cutting the root node is not possible.

Task-number: QTCREATORBUG-17646
Change-Id: I613179c291e744c2d2f6e44ce103bcbd2afaed28
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent f04f09e1
......@@ -107,7 +107,7 @@ void DesignerActionManagerView::selectedNodesChanged(const QList<ModelNode> &sel
* Without this signal the ShortcutManager would have to be refactored completely.
* This signal is only used to update the state of the cut/copy/delete actions.
*/
emit selectionChanged(!selectedNodes.isEmpty());
emit selectionChanged(!selectedNodes.isEmpty(), singleSelectedModelNode().isRootNode());
}
void DesignerActionManagerView::nodeOrderChanged(const NodeListProperty &, const ModelNode &, int)
......
......@@ -68,7 +68,7 @@ public:
const DesignerActionManager &designerActionManager() const;
signals:
void selectionChanged(bool itemsSelected);
void selectionChanged(bool itemsSelected, bool rootItemIsSelected);
protected:
void setupContext();
......
......@@ -268,9 +268,9 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
Core::ActionManager::registerAction(&m_hideSidebarsAction, Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
connect(designerActionManager.view(), &DesignerActionManagerView::selectionChanged, this, [this](bool itemsSelected) {
m_deleteAction.setEnabled(itemsSelected);
m_cutAction.setEnabled(itemsSelected);
connect(designerActionManager.view(), &DesignerActionManagerView::selectionChanged, this, [this](bool itemsSelected, bool rootItemIsSelected) {
m_deleteAction.setEnabled(itemsSelected && !rootItemIsSelected);
m_cutAction.setEnabled(itemsSelected && !rootItemIsSelected);
m_copyAction.setEnabled(itemsSelected);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment