QmlDesigner: Avoid detachs

The non const overloads of first() and last() do detach
if the reference count is higher than 1.
Therefore we use constFirst() and constLast() instead.

Change-Id: I737cfc428f1c21f16185b9b51175e181c0ec7068
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Thomas Hartmann
2018-01-13 18:49:39 +01:00
parent 92d32c3a26
commit a7515d25a9
58 changed files with 160 additions and 160 deletions

View File

@@ -450,7 +450,7 @@ void DesignDocument::paste()
ModelNode targetNode;
if (!view.selectedModelNodes().isEmpty())
targetNode = view.selectedModelNodes().first();
targetNode = view.selectedModelNodes().constFirst();
//In case we copy and paste a selection we paste in the parent item
if ((view.selectedModelNodes().count() == selectedNodes.count()) && targetNode.isValid() && targetNode.hasParentProperty())
@@ -495,7 +495,7 @@ void DesignDocument::paste()
ModelNode targetNode;
if (!view.selectedModelNodes().isEmpty())
targetNode = view.selectedModelNodes().first();
targetNode = view.selectedModelNodes().constFirst();
if (!targetNode.isValid())
targetNode = view.rootModelNode();