aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-05-07 13:56:31 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-05-10 10:00:08 +0200
commitce38ab33fbba4ea8a5f1eda85713f217b8353486 (patch)
tree4434b8cc390d177f5aa3575980ce9038341897f8
parent320ae4646cf667263d14b15bdaf85465972363af (diff)
Fix compiler warning about returning reference to local object
The compiler warns about the code returning a reference from rootIndex(). As there seems to be no good reason why we should return a reference in this case, return a value instead. Fixes: QTBUG-93593 Change-Id: I9eb2dbd95917d28397e648b71c16fc709ab0b429 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/qquicktreemodeladaptor.cpp2
-rw-r--r--src/qquicktreemodeladaptor_p.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/qquicktreemodeladaptor.cpp b/src/qquicktreemodeladaptor.cpp
index 9c6fba2..5a231af 100644
--- a/src/qquicktreemodeladaptor.cpp
+++ b/src/qquicktreemodeladaptor.cpp
@@ -116,7 +116,7 @@ void QQuickTreeModelAdaptor::clearModelData()
endResetModel();
}
-const QModelIndex &QQuickTreeModelAdaptor::rootIndex() const
+QModelIndex QQuickTreeModelAdaptor::rootIndex() const
{
return m_rootIndex;
}
diff --git a/src/qquicktreemodeladaptor_p.h b/src/qquicktreemodeladaptor_p.h
index 88c2d72..c0d015e 100644
--- a/src/qquicktreemodeladaptor_p.h
+++ b/src/qquicktreemodeladaptor_p.h
@@ -65,7 +65,7 @@ public:
explicit QQuickTreeModelAdaptor(QObject *parent = nullptr);
QAbstractItemModel *model() const;
- const QModelIndex &rootIndex() const;
+ QModelIndex rootIndex() const;
void setRootIndex(const QModelIndex &idx);
void resetRootIndex();