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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user