summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2023-04-22 22:29:33 +0200
committerMarco Bubke <marco.bubke@qt.io>2023-05-10 13:48:51 +0000
commit07e3641185c5e5efd45ff0e45d0cdb824bf45ef4 (patch)
treeaf5107cb48344cd1958119df667c58dc31c881a9
parent8129f886bcc50e91f55de15f751df183f0db822c (diff)
downloadqt-creator-07e3641185c5e5efd45ff0e45d0cdb824bf45ef4.tar.gz
QmlDesigner: Remove unneeded calls in GradientModel::rowCount
Change-Id: I13443461ce8a8e1b0d2a13d38f3975d4dd703090 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
index 75b9f34cef..a81560f566 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
@@ -29,14 +29,13 @@ GradientModel::GradientModel(QObject *parent) :
int GradientModel::rowCount(const QModelIndex & /*parent*/) const
{
- if (m_itemNode.isValid()) {
- if (m_itemNode.modelNode().hasNodeProperty(gradientPropertyName().toUtf8())) {
- QmlDesigner::ModelNode gradientNode =
- m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
+ if (m_itemNode.modelNode().hasNodeProperty(gradientPropertyName().toUtf8())) {
+ QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode()
+ .nodeProperty(gradientPropertyName().toUtf8())
+ .modelNode();
- if (gradientNode.hasNodeListProperty("stops"))
- return gradientNode.nodeListProperty("stops").toModelNodeList().count();
- }
+ if (gradientNode.hasNodeListProperty("stops"))
+ return gradientNode.nodeListProperty("stops").count();
}
return 0;