From 9fe7fbd69eabc98f6fe63ef4c4b018fae09442f0 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 2 Jun 2023 20:45:58 +0200 Subject: [PATCH] Simplify logic of Model::fullDisplayName (#6711) Simplify the logic of the method Model::fullDisplayName. Please note that this shows that with the current logic if the parent model has a non-empty name like "parentmodel" and the name of the child model is empty the result is the name "parentmodel >" which might not be what's wanted. --- src/core/Model.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/core/Model.cpp b/src/core/Model.cpp index c59887702..7a7919bb8 100644 --- a/src/core/Model.cpp +++ b/src/core/Model.cpp @@ -56,22 +56,16 @@ void Model::setDisplayName( const QString& displayName ) QString Model::fullDisplayName() const { - const QString & n = displayName(); + const QString n = displayName(); if(parentModel()) { const QString p = parentModel()->fullDisplayName(); - if(n.isEmpty() && p.isEmpty()) + if (!p.isEmpty()) { - return QString(); + return p + ">" + n; } - else if(p.isEmpty()) - { - return n; - } - - return p + ">" + n; } return n;