summaryrefslogtreecommitdiffstats
path: root/src/designer/src/components/formeditor/qdesigner_resource.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-04 13:52:47 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-05 10:42:31 +0200
commit3912157208a91f47274645e3e14a918438816c1d (patch)
tree69184514145d98386c3508be906706ae810edc76 /src/designer/src/components/formeditor/qdesigner_resource.cpp
parent6b98a4915042a97058d51257d51befed9a364c86 (diff)
Qt Designer: Fix some clang warnings
- else after return/break - Misleading indentation - Use reference for const-copies - Mixing const/non-const iterators - Unnecessary pointer check before delete - Unhandled enum value Change-Id: Iecc684d4acf4284b2cd6b1dbd14e392db7ea580c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/designer/src/components/formeditor/qdesigner_resource.cpp')
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index bfb86ee33..4b747d04c 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -278,7 +278,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
const QIcon::Mode mode = itPix.key().first;
const QIcon::State state = itPix.key().second;
DomResourcePixmap *rp = new DomResourcePixmap;
- const PropertySheetPixmapValue pix = itPix.value();
+ const PropertySheetPixmapValue &pix = itPix.value();
const PropertySheetPixmapValue::PixmapSource ps = pix.pixmapSource(m_core);
const QString pixPath = pix.path();
rp->setText(ps == PropertySheetPixmapValue::FilePixmap && m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
@@ -1101,12 +1101,10 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
while (customInfo && customInfo->isCustom()) {
m_usedCustomWidgets.insert(customInfo, true);
const QString extends = customInfo->extends();
- if (extends == customInfo->name()) {
+ if (extends == customInfo->name())
break; // There are faulty files around that have name==extends
- } else {
- const int extendsIndex = wdb->indexOfClassName(customInfo->extends());
- customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) : nullptr;
- }
+ const int extendsIndex = wdb->indexOfClassName(customInfo->extends());
+ customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) : nullptr;
}
}
@@ -1582,7 +1580,8 @@ bool QDesignerResource::addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayo
const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1;
grid->addWidget(item->widget(), ui_item->attributeRow(), ui_item->attributeColumn(), rowSpan, colSpan, item->alignment());
return true;
- } else if (box != nullptr) {
+ }
+ if (box != nullptr) {
box->addItem(item);
return true;
}
@@ -1997,7 +1996,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetStringListValue>()) {
+ }
+ if (value.canConvert<PropertySheetStringListValue>()) {
const PropertySheetStringListValue listValue = qvariant_cast<PropertySheetStringListValue>(value);
DomProperty *p = new DomProperty;
if (!hasSetter(core(), object, propertyName))
@@ -2010,7 +2010,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
translationParametersToDom(listValue, domStringList);
p->setElementStringList(domStringList);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetKeySequenceValue>()) {
+ }
+ if (value.canConvert<PropertySheetKeySequenceValue>()) {
const PropertySheetKeySequenceValue keyVal = qvariant_cast<PropertySheetKeySequenceValue>(value);
DomProperty *p = stringToDomProperty(keyVal.value().toString(), keyVal);
if (!hasSetter(core(), object, propertyName))