Gui: [skip ci] Fix coverity warning

Coverity warnings fixed:

CID 305123 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach the expression this->linked inside this statement: if (role == Qt::TextColorRole && linked)
This commit is contained in:
wmayer
2021-02-21 16:53:23 +01:00
parent 5c4fcaef1d
commit a9bf90cd17

View File

@@ -549,11 +549,13 @@ QVariant PropertyItem::data(int column, int role) const
} }
return QVariant(); return QVariant();
} }
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole) {
return displayName(); return displayName();
}
// no properties set // no properties set
if (propertyItems.empty()) if (propertyItems.empty()) {
return QVariant(); return QVariant();
}
else if (role == Qt::ToolTipRole) { else if (role == Qt::ToolTipRole) {
if(!PropertyView::showAll()) if(!PropertyView::showAll())
return toolTip(propertyItems[0]); return toolTip(propertyItems[0]);
@@ -563,17 +565,17 @@ QVariant PropertyItem::data(int column, int role) const
if(doc.size()) if(doc.size())
return type + QLatin1String("\n\n") + doc; return type + QLatin1String("\n\n") + doc;
return type; return type;
} else if (role == Qt::TextColorRole && linked) }
return QVariant::fromValue(QColor(0,0x80,0));
else
return QVariant(); return QVariant();
} }
else { else {
// no properties set // no properties set
if (propertyItems.empty()) { if (propertyItems.empty()) {
PropertyItem* parent = this->parent(); PropertyItem* parent = this->parent();
if (!parent || !parent->parent()) if (!parent || !parent->parent()) {
return QVariant(); return QVariant();
}
if (role == Qt::EditRole) { if (role == Qt::EditRole) {
return parent->property(qPrintable(objectName())); return parent->property(qPrintable(objectName()));
} }
@@ -585,26 +587,32 @@ QVariant PropertyItem::data(int column, int role) const
QVariant val = parent->property(qPrintable(objectName())); QVariant val = parent->property(qPrintable(objectName()));
return toString(val); return toString(val);
} }
else if( role == Qt::TextColorRole) { else if (role == Qt::TextColorRole) {
if(hasExpression()) if (hasExpression())
return QVariant::fromValue(QApplication::palette().color(QPalette::Link)); return QVariant::fromValue(QApplication::palette().color(QPalette::Link));
return QVariant(); return QVariant();
} else
return QVariant();
} }
if (role == Qt::EditRole)
return QVariant();
}
if (role == Qt::EditRole) {
return value(propertyItems[0]); return value(propertyItems[0]);
else if (role == Qt::DecorationRole) }
else if (role == Qt::DecorationRole) {
return decoration(value(propertyItems[0])); return decoration(value(propertyItems[0]));
else if (role == Qt::DisplayRole) }
else if (role == Qt::DisplayRole) {
return toString(value(propertyItems[0])); return toString(value(propertyItems[0]));
else if (role == Qt::ToolTipRole) }
else if (role == Qt::ToolTipRole) {
return toolTip(propertyItems[0]); return toolTip(propertyItems[0]);
}
else if( role == Qt::TextColorRole) { else if( role == Qt::TextColorRole) {
if(hasExpression()) if (hasExpression())
return QVariant::fromValue(QApplication::palette().color(QPalette::Link)); return QVariant::fromValue(QApplication::palette().color(QPalette::Link));
return QVariant(); return QVariant();
} else }
return QVariant(); return QVariant();
} }
} }