summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-31 13:07:42 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-31 20:32:07 +0000
commit8b581f58effd2679c7cd9522a6d9e3a4c33cb423 (patch)
treef1dbb9f4af08b94c2ef6ff4fbe0ced2db65b7360 /src
parent2ea853ba28e359fba7f98ba1286bc5c89a48105a (diff)
Qt Designer: Fix clang-tidy warnings about if / return statements
- Simplify/streamline if statmenents (comparison against bool literal) - Change else if to if after return/break/continue - Fix indentation - Do not check for non-null before invoking delete on pointer Change-Id: I1b803b01cffd56b3f11e63c3e2e7ae103b1d8799 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp8
-rw-r--r--src/designer/src/components/formeditor/formeditor.cpp4
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp51
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.cpp3
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp21
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.cpp4
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp33
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.cpp3
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp8
-rw-r--r--src/designer/src/components/propertyeditor/qlonglongvalidator.cpp13
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils.cpp2
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp13
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor.cpp2
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_tool.cpp5
-rw-r--r--src/designer/src/designer/qdesigner.cpp9
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp3
-rw-r--r--src/designer/src/designer/qdesigner_workbench.cpp72
-rw-r--r--src/designer/src/lib/shared/connectionedit.cpp5
-rw-r--r--src/designer/src/lib/shared/htmlhighlighter.cpp3
-rw-r--r--src/designer/src/lib/shared/layout.cpp9
-rw-r--r--src/designer/src/lib/shared/layoutinfo.cpp8
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu.cpp7
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp18
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp6
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp4
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp26
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel.cpp2
-rw-r--r--src/designer/src/lib/shared/widgetfactory.cpp25
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp30
-rw-r--r--src/designer/src/lib/uilib/properties.cpp5
31 files changed, 193 insertions, 217 deletions
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp
index 75b1f011c..d5a779580 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -176,7 +176,7 @@ void BuddyEditor::updateBackground()
std::any_of(newList.cbegin(), newList.cend(),
[source, target] (const Connection *nc)
{ return nc->object(EndPoint::Source) == source && nc->object(EndPoint::Target) == target; });
- if (found == false)
+ if (!found)
toRemove.append(con);
}
if (!toRemove.isEmpty()) {
@@ -197,11 +197,11 @@ void BuddyEditor::updateBackground()
break;
}
}
- if (found == false) {
+ if (found) {
+ delete newConn;
+ } else {
AddConnectionCommand command(this, newConn);
command.redo();
- } else {
- delete newConn;
}
}
m_updating = false;
diff --git a/src/designer/src/components/formeditor/formeditor.cpp b/src/designer/src/components/formeditor/formeditor.cpp
index e29a94bbc..335241e5f 100644
--- a/src/designer/src/components/formeditor/formeditor.cpp
+++ b/src/designer/src/components/formeditor/formeditor.cpp
@@ -155,9 +155,9 @@ void FormEditor::slotQrcFileChangedExternally(const QString &path)
return;
QDesignerIntegration::ResourceFileWatcherBehaviour behaviour = integration()->resourceFileWatcherBehaviour();
- if (behaviour == QDesignerIntegration::NoResourceFileWatcher) {
+ if (behaviour == QDesignerIntegration::NoResourceFileWatcher)
return;
- } else if (behaviour == QDesignerIntegration::PromptToReloadResourceFile) {
+ if (behaviour == QDesignerIntegration::PromptToReloadResourceFile) {
QMessageBox::StandardButton button = dialogGui()->message(topLevel(), QDesignerDialogGuiInterface::FileChangedMessage, QMessageBox::Warning,
tr("Resource File Changed"),
tr("The file \"%1\" has changed outside Designer. Do you want to reload it?").arg(path),
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index 316c16cab..f680cc008 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -603,7 +603,7 @@ bool FormWindow::handleMousePressEvent(QWidget * widget, QWidget *managedWidget,
if (debugFormWindow)
qDebug() << "handleMousePressEvent:" << widget << ',' << managedWidget;
- if (buttons == Qt::MidButton || isMainContainer(managedWidget) == true) { // press was on the formwindow
+ if (buttons == Qt::MidButton || isMainContainer(managedWidget)) { // press was on the formwindow
clearObjectInspectorSelection(m_core); // We might have a toolbar or non-widget selected in the object inspector.
clearSelection(false);
@@ -677,10 +677,8 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
const bool canStartDrag = (m_startPos - pos).manhattanLength() > QApplication::startDragDistance();
- if (canStartDrag == false) {
- // nothing to do
+ if (!canStartDrag) // nothing to do
return true;
- }
m_mouseState = MouseMoveDrag;
const bool blocked = blockSelectionChanged(true);
@@ -698,7 +696,8 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
if (!isManaged(current)) {
current = current->parentWidget();
continue;
- } else if (LayoutInfo::isWidgetLaidout(core(), current)) {
+ }
+ if (LayoutInfo::isWidgetLaidout(core(), current)) {
// Go up to parent of layout if shift pressed, else do that only for splitters
if (!canDragWidgetInLayout(core(), current)) {
current = current->parentWidget();
@@ -917,10 +916,8 @@ void FormWindow::clearSelection(bool changePropertyDisplay)
void FormWindow::emitSelectionChanged()
{
- if (m_blockSelectionChanged == true) {
- // nothing to do
+ if (m_blockSelectionChanged) // nothing to do
return;
- }
m_selectionChangedTimer->start(0);
}
@@ -1171,9 +1168,8 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
const StringSet::const_iterator enEnd = existingNames.constEnd();
if (existingNames.constFind(s) == enEnd)
return true;
- else
- if (!changeIt)
- return false;
+ if (!changeIt)
+ return false;
// split 'name_number'
qlonglong num = 0;
@@ -1752,9 +1748,8 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount)
ui = new DomUI();
ui->read(reader);
break;
- } else {
- reader.raiseError(QCoreApplication::translate("FormWindow", "Unexpected element <%1>").arg(reader.name().toString()));
}
+ reader.raiseError(QCoreApplication::translate("FormWindow", "Unexpected element <%1>").arg(reader.name().toString()));
}
}
if (reader.hasError()) {
@@ -2082,13 +2077,13 @@ QMenu *FormWindow::initializePopupMenu(QWidget *managedWidget)
// of a multiselection to be correct.
const bool selected = isWidgetSelected(managedWidget);
bool update = false;
- if (selected == false) {
+ if (selected) {
+ update = setCurrentWidget(managedWidget);
+ } else {
clearObjectInspectorSelection(m_core); // We might have a toolbar or non-widget selected in the object inspector.
clearSelection(false);
update = trySelectWidget(managedWidget, true);
raiseChildSelections(managedWidget); // raise selections and select widget
- } else {
- update = setCurrentWidget(managedWidget);
}
if (update) {
@@ -2759,9 +2754,9 @@ static Qt::DockWidgetArea detectDropArea(QMainWindow *mainWindow, const QRect &a
if (topRight && topLeft)
return Qt::TopDockWidgetArea;
- else if (topRight && !topLeft)
+ if (topRight && !topLeft)
return Qt::RightDockWidgetArea;
- else if (!topRight && topLeft)
+ if (!topRight && topLeft)
return Qt::LeftDockWidgetArea;
return Qt::BottomDockWidgetArea;
}
@@ -2769,24 +2764,14 @@ static Qt::DockWidgetArea detectDropArea(QMainWindow *mainWindow, const QRect &a
if (x < 0) {
if (y < 0)
return mainWindow->corner(Qt::TopLeftCorner);
- else if (y > h)
- return mainWindow->corner(Qt::BottomLeftCorner);
- else
- return Qt::LeftDockWidgetArea;
- } else if (x > w) {
+ return y > h ? mainWindow->corner(Qt::BottomLeftCorner) : Qt::LeftDockWidgetArea;
+ }
+ if (x > w) {
if (y < 0)
return mainWindow->corner(Qt::TopRightCorner);
- else if (y > h)
- return mainWindow->corner(Qt::BottomRightCorner);
- else
- return Qt::RightDockWidgetArea;
- } else {
- if (y < 0)
- return Qt::TopDockWidgetArea;
- else
- return Qt::BottomDockWidgetArea;
+ return y > h ? mainWindow->corner(Qt::BottomRightCorner) : Qt::RightDockWidgetArea;
}
- return Qt::LeftDockWidgetArea;
+ return y < 0 ? Qt::TopDockWidgetArea :Qt::LeftDockWidgetArea;
}
bool FormWindow::dropDockWidget(QDesignerDnDItemInterface *item, const QPoint &global_mouse_pos)
diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.cpp b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
index 5c01e61ce..897110f1d 100644
--- a/src/designer/src/components/formeditor/itemview_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
@@ -250,9 +250,8 @@ bool ItemViewPropertySheet::reset(int index)
return true;
}
return resetRC;
- } else {
- return QDesignerPropertySheet::reset(index);
}
+ return QDesignerPropertySheet::reset(index);
}
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index 78882fdfa..82116ec2f 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -265,7 +265,8 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
}
p->setElementPixmap(rp);
return p;
- } else if (value.canConvert<PropertySheetIconValue>()) {
+ }
+ if (value.canConvert<PropertySheetIconValue>()) {
const PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(value);
const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> pixmaps = icon.paths();
const QString theme = icon.theme();
@@ -323,9 +324,8 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
bool QDesignerResourceBuilder::isResourceType(const QVariant &value) const
{
- if (value.canConvert<PropertySheetPixmapValue>() || value.canConvert<PropertySheetIconValue>())
- return true;
- return false;
+ return value.canConvert<PropertySheetPixmapValue>()
+ || value.canConvert<PropertySheetIconValue>();
}
// ------------------------- QDesignerTextBuilder
@@ -882,7 +882,8 @@ QLayoutItem *QDesignerResource::create(DomLayoutItem *ui_layoutItem, QLayout *la
}
return new QWidgetItem(spacer);
- } else if (ui_layoutItem->kind() == DomLayoutItem::Layout && parentWidget) {
+ }
+ if (ui_layoutItem->kind() == DomLayoutItem::Layout && parentWidget) {
DomLayout *ui_layout = ui_layoutItem->elementLayout();
QLayoutWidget *layoutWidget = new QLayoutWidget(m_formWindow, parentWidget);
core()->metaDataBase()->add(layoutWidget);
@@ -1095,7 +1096,7 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
if (!item)
return 0;
- if (qobject_cast<Spacer*>(widget) && m_copyWidget == false)
+ if (qobject_cast<Spacer*>(widget) && !m_copyWidget)
return 0;
const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase();
@@ -1802,7 +1803,7 @@ FormBuilderClipboard QDesignerResource::paste(QIODevice *dev, QWidget *widgetPar
.arg(reader.lineNumber()).arg(reader.columnNumber())
.arg(reader.errorString()));
uiInitialized = false;
- } else if (uiInitialized == false) {
+ } else if (!uiInitialized) {
//: Parsing clipboard contents
designerWarning(QCoreApplication::translate("QDesignerResource", "Error while pasting clipboard contents: The root element <ui> is missing."));
}
@@ -1977,7 +1978,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
p->setElementSet(flagString);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetEnumValue>()) {
+ }
+ if (value.canConvert<PropertySheetEnumValue>()) {
const PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(value);
bool ok;
const QString id = e.metaEnum.toString(e.value, DesignerMetaEnum::FullyQualified, &ok);
@@ -1993,7 +1995,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
p->setElementEnum(id);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetStringValue>()) {
+ }
+ if (value.canConvert<PropertySheetStringValue>()) {
const PropertySheetStringValue strVal = qvariant_cast<PropertySheetStringValue>(value);
DomProperty *p = stringToDomProperty(strVal.value(), strVal);
if (!hasSetter(core(), object, propertyName))
diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp
index 4143629f3..dae93909d 100644
--- a/src/designer/src/components/objectinspector/objectinspector.cpp
+++ b/src/designer/src/components/objectinspector/objectinspector.cpp
@@ -300,7 +300,7 @@ void ObjectInspector::ObjectInspectorPrivate::showContainersCurrentPage(QWidget
if (count > 1 && !c->widget(c->currentIndex())->isAncestorOf(widget)) {
for (int i = 0; i < count; i++)
if (c->widget(i)->isAncestorOf(widget)) {
- if (macroStarted == false) {
+ if (!macroStarted) {
macroStarted = true;
fw->beginCommand(tr("Change Current Page"));
}
@@ -314,7 +314,7 @@ void ObjectInspector::ObjectInspectorPrivate::showContainersCurrentPage(QWidget
}
w = w->parentWidget();
}
- if (macroStarted == true)
+ if (macroStarted)
fw->endCommand();
}
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 0577709d6..9b73139f8 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -1272,7 +1272,8 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = val;
emit attributeChanged(variantProperty(property), attribute, value);
return;
- } else if (attribute == QLatin1String(flagsAttributeC) && m_flagValues.contains(property)) {
+ }
+ if (attribute == QLatin1String(flagsAttributeC) && m_flagValues.contains(property)) {
if (value.userType() != designerFlagListTypeId())
return;
@@ -1793,7 +1794,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_alignValues.contains(property)) {
+ }
+ if (m_alignValues.contains(property)) {
if (value.type() != QVariant::UInt && !value.canConvert(QVariant::UInt))
return;
@@ -1818,7 +1820,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_paletteValues.contains(property)) {
+ }
+ if (m_paletteValues.contains(property)) {
if (value.type() != QVariant::Palette && !value.canConvert(QVariant::Palette))
return;
@@ -1840,7 +1843,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_iconValues.contains(property)) {
+ }
+ if (m_iconValues.contains(property)) {
if (value.userType() != designerIconTypeId())
return;
@@ -1891,7 +1895,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
property->setToolTip(QDir::toNativeSeparators(toolTip));
return;
- } else if (m_pixmapValues.contains(property)) {
+ }
+ if (m_pixmapValues.contains(property)) {
if (value.userType() != designerPixmapTypeId())
return;
@@ -1910,7 +1915,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
property->setToolTip(QDir::toNativeSeparators(pixmap.path()));
return;
- } else if (m_uintValues.contains(property)) {
+ }
+ if (m_uintValues.contains(property)) {
if (value.type() != QVariant::UInt && !value.canConvert(QVariant::UInt))
return;
@@ -1926,7 +1932,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_longLongValues.contains(property)) {
+ }
+ if (m_longLongValues.contains(property)) {
if (value.type() != QVariant::LongLong && !value.canConvert(QVariant::LongLong))
return;
@@ -1942,7 +1949,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_uLongLongValues.contains(property)) {
+ }
+ if (m_uLongLongValues.contains(property)) {
if (value.type() != QVariant::ULongLong && !value.canConvert(QVariant::ULongLong))
return;
@@ -1958,7 +1966,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_urlValues.contains(property)) {
+ }
+ if (m_urlValues.contains(property)) {
if (value.type() != QVariant::Url && !value.canConvert(QVariant::Url))
return;
@@ -1974,7 +1983,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
return;
- } else if (m_byteArrayValues.contains(property)) {
+ }
+ if (m_byteArrayValues.contains(property)) {
if (value.type() != QVariant::ByteArray && !value.canConvert(QVariant::ByteArray))
return;
@@ -2193,7 +2203,8 @@ bool DesignerPropertyManager::resetIconSubProperty(QtProperty *property)
QtVariantProperty *pixmapProperty = variantProperty(property);
pixmapProperty->setValue(QVariant::fromValue(PropertySheetPixmapValue()));
return true;
- } else if (m_propertyToTheme.contains(iconProperty)) {
+ }
+ if (m_propertyToTheme.contains(iconProperty)) {
QtVariantProperty *themeProperty = variantProperty(property);
themeProperty->setValue(QString());
return true;
diff --git a/src/designer/src/components/propertyeditor/paletteeditor.cpp b/src/designer/src/components/propertyeditor/paletteeditor.cpp
index 929ce1801..9bb045bd2 100644
--- a/src/designer/src/components/propertyeditor/paletteeditor.cpp
+++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp
@@ -468,9 +468,8 @@ void RoleEditor::setLabel(const QString &label)
void RoleEditor::setEdited(bool on)
{
QFont font;
- if (on == true) {
+ if (on)
font.setBold(on);
- }
m_label->setFont(font);
m_edited = on;
}
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index 759e09eed..1fee704d2 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -418,7 +418,7 @@ bool PropertyEditor::isExpanded(QtBrowserItem *item) const
{
if (m_buttonBrowser == m_currentBrowser)
return m_buttonBrowser->isExpanded(item);
- else if (m_treeBrowser == m_currentBrowser)
+ if (m_treeBrowser == m_currentBrowser)
return m_treeBrowser->isExpanded(item);
return false;
}
@@ -1239,10 +1239,8 @@ bool PropertyEditor::isDynamicProperty(const QtBrowserItem* item) const
if (!dynamicSheet)
return false;
- if (m_propertyToGroup.contains(item->property())
- && dynamicSheet->isDynamicProperty(m_propertySheet->indexOf(item->property()->propertyName())))
- return true;
- return false;
+ return m_propertyToGroup.contains(item->property())
+ && dynamicSheet->isDynamicProperty(m_propertySheet->indexOf(item->property()->propertyName()));
}
void PropertyEditor::editProperty(const QString &name)
diff --git a/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp b/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
index 1a9c1c8aa..9a780cf94 100644
--- a/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
+++ b/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
@@ -55,16 +55,13 @@ QValidator::State QLongLongValidator::validate(QString & input, int &) const
return Intermediate;
bool ok;
qlonglong entered = input.toLongLong(&ok);
- if (!ok || (entered < 0 && b >= 0)) {
+ if (!ok || (entered < 0 && b >= 0))
return Invalid;
- } else if (entered >= b && entered <= t) {
+ if (entered >= b && entered <= t)
return Acceptable;
- } else {
- if (entered >= 0)
- return (entered > t) ? Invalid : Intermediate;
- else
- return (entered < b) ? Invalid : Intermediate;
- }
+ if (entered >= 0)
+ return entered > t ? Invalid : Intermediate;
+ return entered < b ? Invalid : Intermediate;
}
void QLongLongValidator::setRange(qlonglong bottom, qlonglong top)
diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
index 6c19a756e..0def07552 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
@@ -273,7 +273,7 @@ namespace qdesigner_internal {
QString realObjectName(QDesignerFormEditorInterface *core, QObject *object)
{
if (!object)
- return QString();
+ return QString();
const QDesignerMetaDataBaseInterface *mdb = core->metaDataBase();
if (const QDesignerMetaDataBaseItemInterface *item = mdb->item(object))
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index 41c539141..4358007c0 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -472,10 +472,9 @@ void InlineEditorModel::addTextList(const QMap<QString, bool> &text_list)
Qt::ItemFlags InlineEditorModel::flags(const QModelIndex &index) const
{
- if (isTitle(index.row()))
- return Qt::ItemIsEnabled;
- else
- return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
+ return isTitle(index.row())
+ ? Qt::ItemFlags(Qt::ItemIsEnabled)
+ : Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
int InlineEditorModel::findText(const QString &text) const
@@ -531,9 +530,9 @@ void InlineEditor::checkSelection(int idx)
return;
if (m_model->isTitle(idx))
- setCurrentIndex(m_idx);
- else
- m_idx = idx;
+ setCurrentIndex(m_idx);
+ else
+ m_idx = idx;
}
void InlineEditor::addTitle(const QString &title)
diff --git a/src/designer/src/components/tabordereditor/tabordereditor.cpp b/src/designer/src/components/tabordereditor/tabordereditor.cpp
index 375ed176f..e4139fbea 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor.cpp
@@ -152,7 +152,7 @@ void TabOrderEditor::paintEvent(QPaintEvent *e)
p.setClipRegion(e->region());
int cur = m_current_index - 1;
- if (m_beginning == false && cur < 0)
+ if (!m_beginning && cur < 0)
cur = m_tab_order_list.size() - 1;
for (int i = 0; i < m_tab_order_list.size(); ++i) {
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
index 7a5489c0c..fb7eab92b 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
@@ -62,10 +62,7 @@ bool TabOrderEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QE
Q_UNUSED(widget);
Q_UNUSED(managedWidget);
- if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
- return true;
-
- return false;
+ return event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease;
}
QWidget *TabOrderEditorTool::editor() const
diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp
index 10b55e564..daec73b08 100644
--- a/src/designer/src/designer/qdesigner.cpp
+++ b/src/designer/src/designer/qdesigner.cpp
@@ -89,12 +89,9 @@ QDesigner::QDesigner(int &argc, char **argv)
QDesigner::~QDesigner()
{
- if (m_workbench)
- delete m_workbench;
- if (m_server)
- delete m_server;
- if (m_client)
- delete m_client;
+ delete m_workbench;
+ delete m_server;
+ delete m_client;
}
void QDesigner::showErrorMessage(const char *message)
diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp
index 60c8ffb4b..70f277e37 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -873,7 +873,8 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr
if (box.clickedButton() == cancelButton) {
removeBackup(backupFile);
return false;
- } else if (box.clickedButton() == switchButton) {
+ }
+ if (box.clickedButton() == switchButton) {
QString extension = uiExtension();
const QString fileName = QFileDialog::getSaveFileName(fw, tr("Save Form As"),
QDir::current().absolutePath(),
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp
index 28e42e26e..b725248f6 100644
--- a/src/designer/src/designer/qdesigner_workbench.cpp
+++ b/src/designer/src/designer/qdesigner_workbench.cpp
@@ -697,44 +697,42 @@ bool QDesignerWorkbench::handleClose()
dirtyForms << w;
}
- if (dirtyForms.size()) {
- if (dirtyForms.size() == 1) {
- if (!dirtyForms.at(0)->close()) {
- m_state = StateUp;
- return false;
+ const int count = dirtyForms.size();
+ if (count == 1) {
+ if (!dirtyForms.at(0)->close()) {
+ m_state = StateUp;
+ return false;
+ }
+ } else if (count > 1) {
+ QMessageBox box(QMessageBox::Warning, tr("Save Forms?"),
+ tr("There are %n forms with unsaved changes."
+ " Do you want to review these changes before quitting?", "", count),
+ QMessageBox::Cancel | QMessageBox::Discard | QMessageBox::Save);
+ box.setInformativeText(tr("If you do not review your documents, all your changes will be lost."));
+ box.button(QMessageBox::Discard)->setText(tr("Discard Changes"));
+ QPushButton *save = static_cast<QPushButton *>(box.button(QMessageBox::Save));
+ save->setText(tr("Review Changes"));
+ box.setDefaultButton(save);
+ switch (box.exec()) {
+ case QMessageBox::Cancel:
+ m_state = StateUp;
+ return false;
+ case QMessageBox::Save:
+ for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
+ fw->show();
+ fw->raise();
+ if (!fw->close()) {
+ m_state = StateUp;
+ return false;
+ }
}
- } else {
- int count = dirtyForms.size();
- QMessageBox box(QMessageBox::Warning, tr("Save Forms?"),
- tr("There are %n forms with unsaved changes."
- " Do you want to review these changes before quitting?", "", count),
- QMessageBox::Cancel | QMessageBox::Discard | QMessageBox::Save);
- box.setInformativeText(tr("If you do not review your documents, all your changes will be lost."));
- box.button(QMessageBox::Discard)->setText(tr("Discard Changes"));
- QPushButton *save = static_cast<QPushButton *>(box.button(QMessageBox::Save));
- save->setText(tr("Review Changes"));
- box.setDefaultButton(save);
- switch (box.exec()) {
- case QMessageBox::Cancel:
- m_state = StateUp;
- return false;
- case QMessageBox::Save:
- for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
- fw->show();
- fw->raise();
- if (!fw->close()) {
- m_state = StateUp;
- return false;
- }
- }
- break;
- case QMessageBox::Discard:
- for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
- fw->editor()->setDirty(false);
- fw->setWindowModified(false);
- }
- break;
+ break;
+ case QMessageBox::Discard:
+ for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
+ fw->editor()->setDirty(false);
+ fw->setWindowModified(false);
}
+ break;
}
}
@@ -757,7 +755,7 @@ void QDesignerWorkbench::updateWindowMenu(QDesignerFormWindowInterface *fwi)
QDesignerFormWindow *activeFormWindow = 0;
do {
if (!fwi)
- break;
+ break;
activeFormWindow = qobject_cast<QDesignerFormWindow *>(fwi->parentWidget());
if (!activeFormWindow)
break;
diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp
index d02f96e91..556d2039c 100644
--- a/src/designer/src/lib/shared/connectionedit.cpp
+++ b/src/designer/src/lib/shared/connectionedit.cpp
@@ -347,10 +347,7 @@ bool Connection::ground() const
QPoint Connection::endPointPos(EndPoint::Type type) const
{
- if (type == EndPoint::Source)
- return m_source_pos;
- else
- return m_target_pos;
+ return type == EndPoint::Source ? m_source_pos : m_target_pos;
}
static QPoint lineEntryPos(const QPoint &p1, const QPoint &p2, const QRect &rect)
diff --git a/src/designer/src/lib/shared/htmlhighlighter.cpp b/src/designer/src/lib/shared/htmlhighlighter.cpp
index 8ce2291da..14e5b8d41 100644
--- a/src/designer/src/lib/shared/htmlhighlighter.cpp
+++ b/src/designer/src/lib/shared/htmlhighlighter.cpp
@@ -113,7 +113,8 @@ void HtmlHighlighter::highlightBlock(const QString &text)
break;
}
break;
- } else if (ch == amp) {
+ }
+ if (ch == amp) {
start = pos;
while (pos < len && text.at(pos++) != semicolon)
;
diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp
index fef4872f1..f11600737 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -267,13 +267,16 @@ void Layout::finishLayout(bool needMove, QLayout *layout)
if (!m_formWindow->isManaged(widget)) {
widget = widget->parentWidget();
continue;
- } else if (LayoutInfo::isWidgetLaidout(m_formWindow->core(), widget)) {
+ }
+ if (LayoutInfo::isWidgetLaidout(m_formWindow->core(), widget)) {
widget = widget->parentWidget();
continue;
- } else if (isPageOfContainerWidget(m_formWindow, widget)) {
+ }
+ if (isPageOfContainerWidget(m_formWindow, widget)) {
widget = widget->parentWidget();
continue;
- } else if (widget->parentWidget()) {
+ }
+ if (widget->parentWidget()) {
QScrollArea *area = qobject_cast<QScrollArea*>(widget->parentWidget()->parentWidget());
if (area && area->widget() == widget) {
widget = area;
diff --git a/src/designer/src/lib/shared/layoutinfo.cpp b/src/designer/src/lib/shared/layoutinfo.cpp
index 060ea6bd5..130c62bcd 100644
--- a/src/designer/src/lib/shared/layoutinfo.cpp
+++ b/src/designer/src/lib/shared/layoutinfo.cpp
@@ -51,13 +51,13 @@ LayoutInfo::Type LayoutInfo::layoutType(const QDesignerFormEditorInterface *core
Q_UNUSED(core)
if (!layout)
return NoLayout;
- else if (qobject_cast<const QHBoxLayout*>(layout))
+ if (qobject_cast<const QHBoxLayout*>(layout))
return HBox;
- else if (qobject_cast<const QVBoxLayout*>(layout))
+ if (qobject_cast<const QVBoxLayout*>(layout))
return VBox;
- else if (qobject_cast<const QGridLayout*>(layout))
+ if (qobject_cast<const QGridLayout*>(layout))
return Grid;
- else if (qobject_cast<const QFormLayout*>(layout))
+ if (qobject_cast<const QFormLayout*>(layout))
return Form;
return UnknownLayout;
}
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
index 0fbf7d736..fc7765cea 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -298,11 +298,11 @@ int PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::browseSkin()
rc = m_browseSkinIndex++;
break;
- } else {
- const QString msgTitle = tr("%1 - Error").arg(title);
- const QString msg = tr("%1 is not a valid skin directory:\n%2").arg(directory).arg(readError);
- QMessageBox::warning (m_parent, msgTitle, msg);
}
+ const QString msgTitle = tr("%1 - Error").arg(title);
+ const QString msg = tr("%1 is not a valid skin directory:\n%2")
+ .arg(directory, readError);
+ QMessageBox::warning (m_parent, msgTitle, msg);
} while (true);
return rc;
}
diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp
index 46d97ba7a..fffffeb38 100644
--- a/src/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menu.cpp
@@ -252,7 +252,8 @@ bool QDesignerMenu::handleKeyPressEvent(QWidget * /*widget*/, QKeyEvent *e)
if (!action || action->isSeparator() || action == m_addSeparator) {
e->ignore();
return true;
- } else if (!e->text().isEmpty() && e->text().at(0).toLatin1() >= 32) {
+ }
+ if (!e->text().isEmpty() && e->text().at(0).toLatin1() >= 32) {
showLineEdit();
QApplication::sendEvent(m_editor, e);
e->accept();
@@ -868,9 +869,7 @@ bool QDesignerMenu::hideSubMenuOnCursorKey()
}
closeMenuChain();
update();
- if (parentMenuBar())
- return false;
- return true;
+ return parentMenuBar() == nullptr;
}
// Open a submenu using the left/right keys according to layoutDirection().
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 1f1348f29..ae00b5642 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -724,14 +724,10 @@ bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) cons
return false; // property already exists and is not a dynamic one
if (d->m_addIndex.contains(propName)) {
const int idx = d->m_addIndex.value(propName);
- if (isVisible(idx))
- return false; // dynamic property already exists
- else
- return true;
+ return !isVisible(idx); // dynamic property already exists
}
- if (!QDesignerPropertySheet::internalDynamicPropertiesEnabled() && propName.startsWith(QStringLiteral("_q_")))
- return false;
- return true;
+ return QDesignerPropertySheet::internalDynamicPropertiesEnabled()
+ || !propName.startsWith(QStringLiteral("_q_"));
}
int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QVariant &value)
@@ -1344,12 +1340,14 @@ bool QDesignerPropertySheet::reset(int index)
return true;
}
return false;
- } else if (isFakeProperty(index)) {
+ }
+ if (isFakeProperty(index)) {
const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
const bool result = p->reset(d->m_object);
d->m_fakeProperties[index] = p->read(d->m_object);
return result;
- } else if (propertyType(index) == PropertyGeometry && d->m_object->isWidgetType()) {
+ }
+ if (propertyType(index) == PropertyGeometry && d->m_object->isWidgetType()) {
if (QWidget *w = qobject_cast<QWidget*>(d->m_object)) {
QWidget *widget = w;
if (qdesigner_internal::Utils::isCentralWidget(d->m_fwb, widget) && d->m_fwb->parentWidget())
@@ -1571,7 +1569,7 @@ bool QDesignerPropertySheet::isEnabled(int index) const
return !isManaged || lt == qdesigner_internal::LayoutInfo::NoLayout;
}
- if (d->m_info.value(index).visible == true) // Sun CC 5.5 oddity, wants true
+ if (d->m_info.value(index).visible)
return true;
// Enable setting of properties for statically non-designable properties
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index 0c78fe8c8..3be1fb94d 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -349,7 +349,7 @@ namespace qdesigner_internal
const ModeStateKey otherPair = itOther.key();
if (thisPair < otherPair)
return true;
- else if (otherPair < thisPair)
+ if (otherPair < thisPair)
return false;
const int crc = itThis.value().compare(itOther.value());
if (crc < 0)
@@ -359,9 +359,7 @@ namespace qdesigner_internal
++itThis;
++itOther;
}
- if (itOther != itOtherEnd)
- return true;
- return false;
+ return itOther != itOtherEnd;
}
bool PropertySheetIconValue::isEmpty() const
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index 6b8130029..65adb1206 100644
--- a/src/designer/src/lib/shared/qlayout_widget.cpp
+++ b/src/designer/src/lib/shared/qlayout_widget.cpp
@@ -1948,7 +1948,7 @@ void QLayoutWidget::paintEvent(QPaintEvent*)
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
const QRect cellRect = grid->cellRect(i, j);
- if (j < columnCount - 1 && excludedColumnsForRow.value(i).value(j, false) == false) {
+ if (j < columnCount - 1 && !excludedColumnsForRow.value(i).value(j, false)) {
const double y0 = (i == 0)
? 0 : (grid->cellRect(i - 1, j).bottom() + cellRect.top()) / 2.0;
const double y1 = (i == rowCount - 1)
@@ -1956,7 +1956,7 @@ void QLayoutWidget::paintEvent(QPaintEvent*)
const double x = (cellRect.right() + grid->cellRect(i, j + 1).left()) / 2.0;
p.drawLine(QPointF(x, y0), QPointF(x, y1));
}
- if (i < rowCount - 1 && excludedRowsForColumn.value(j).value(i, false) == false) {
+ if (i < rowCount - 1 && !excludedRowsForColumn.value(j).value(i, false)) {
const double x0 = (j == 0)
? 0 : (grid->cellRect(i, j - 1).right() + cellRect.left()) / 2.0;
const double x1 = (j == columnCount - 1)
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
index 05338c063..b072b00ad 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -75,32 +75,26 @@ namespace {
struct QtResourceFileData {
QString path;
QString alias;
- bool operator==(const QtResourceFileData &other) const {
- if (path == other.path && alias == other.alias)
- return true;
- return false;
- }
+ bool operator==(const QtResourceFileData &other) const
+ { return path == other.path && alias == other.alias; }
};
struct QtResourcePrefixData {
QString prefix;
QString language;
QList<QtResourceFileData> resourceFileList;
- bool operator==(const QtResourcePrefixData &other) const {
- if (prefix == other.prefix && language == other.language && resourceFileList == other.resourceFileList)
- return true;
- return false;
+ bool operator==(const QtResourcePrefixData &other) const
+ {
+ return prefix == other.prefix && language == other.language
+ && resourceFileList == other.resourceFileList;
}
};
struct QtQrcFileData {
QString qrcPath;
QList<QtResourcePrefixData> resourceList;
- bool operator==(const QtQrcFileData &other) const {
- if (qrcPath == other.qrcPath && resourceList == other.resourceList)
- return true;
- return false;
- }
+ bool operator==(const QtQrcFileData &other) const
+ { return qrcPath == other.qrcPath && resourceList == other.resourceList; }
};
bool loadResourceFileData(const QDomElement &fileElem, QtResourceFileData *fileData, QString *errorMessage)
@@ -1794,7 +1788,7 @@ QString QtResourceEditorDialogPrivate::browseForNewLocation(const QString &resou
{
QFileInfo fi(resourceFile);
const QString initialPath = rootDir.absoluteFilePath(fi.fileName());
- while (1) {
+ while (true) {
QString newPath = m_dlgGui->getSaveFileName(q_ptr,
QCoreApplication::translate("QtResourceEditorDialog", "Copy As"),
initialPath);
@@ -2102,7 +2096,7 @@ QString QtResourceEditorDialog::selectedResource() const
const QString dotSlash(QStringLiteral("./"));
const QString dotDotSlash(QStringLiteral("../"));
- while (1) {
+ while (true) {
if (resourceEnding.startsWith(slash))
resourceEnding = resourceEnding.mid(1);
else if (resourceEnding.startsWith(dotSlash))
diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp
index 0e06bc25b..e3fa77c69 100644
--- a/src/designer/src/lib/shared/qtresourcemodel.cpp
+++ b/src/designer/src/lib/shared/qtresourcemodel.cpp
@@ -416,7 +416,7 @@ void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable)
void QtResourceModelPrivate::addWatcher(const QString &path)
{
QMap<QString, bool>::ConstIterator it = m_fileWatchedMap.constFind(path);
- if (it != m_fileWatchedMap.constEnd() && it.value() == false)
+ if (it != m_fileWatchedMap.constEnd() && !it.value())
return;
m_fileWatchedMap.insert(path, true);
diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp
index 3fffe610d..003096228 100644
--- a/src/designer/src/lib/shared/widgetfactory.cpp
+++ b/src/designer/src/lib/shared/widgetfactory.cpp
@@ -439,16 +439,16 @@ QString WidgetFactory::classNameOf(QDesignerFormEditorInterface *c, const QObjec
return customClassName;
if (qobject_cast<const QDesignerMenuBar*>(w))
return QStringLiteral("QMenuBar");
- else if (qobject_cast<const QDesignerMenu*>(w))
+ if (qobject_cast<const QDesignerMenu*>(w))
return QStringLiteral("QMenu");
- else if (qobject_cast<const QDesignerDockWidget*>(w))
+ if (qobject_cast<const QDesignerDockWidget*>(w))
return QStringLiteral("QDockWidget");
- else if (qobject_cast<const QDesignerDialog*>(w))
+ if (qobject_cast<const QDesignerDialog*>(w))
return QStringLiteral("QDialog");
- else if (qobject_cast<const QDesignerWidget*>(w))
+ if (qobject_cast<const QDesignerWidget*>(w))
return QStringLiteral("QWidget");
#ifdef Q_OS_WIN
- else if (isAxWidget(w))
+ if (isAxWidget(w))
return QStringLiteral("QAxWidget");
#endif
return QLatin1String(className);
@@ -806,19 +806,22 @@ bool WidgetFactory::isPassiveInteractor(QWidget *widget)
if (isTabBarInteractor(tabBar))
m_lastWasAPassiveInteractor = true;
return m_lastWasAPassiveInteractor;
+ }
#ifndef QT_NO_SIZEGRIP
- } else if (qobject_cast<QSizeGrip*>(widget)) {
+ if (qobject_cast<QSizeGrip*>(widget))
return (m_lastWasAPassiveInteractor = true);
#endif
- } else if (qobject_cast<QMdiSubWindow*>(widget))
+ if (qobject_cast<QMdiSubWindow*>(widget))
return (m_lastWasAPassiveInteractor = true);
- else if (qobject_cast<QAbstractButton*>(widget) && (qobject_cast<QTabBar*>(widget->parent()) || qobject_cast<QToolBox*>(widget->parent())))
+ if (qobject_cast<QAbstractButton*>(widget)
+ && (qobject_cast<QTabBar*>(widget->parent()) || qobject_cast<QToolBox*>(widget->parent()))) {
return (m_lastWasAPassiveInteractor = true);
- else if (qobject_cast<QMenuBar*>(widget))
+ }
+ if (qobject_cast<QMenuBar*>(widget))
return (m_lastWasAPassiveInteractor = true);
- else if (qobject_cast<QToolBar*>(widget))
+ if (qobject_cast<QToolBar*>(widget))
return (m_lastWasAPassiveInteractor = true);
- else if (qobject_cast<QScrollBar*>(widget)) {
+ if (qobject_cast<QScrollBar*>(widget)) {
// A scroll bar is an interactor on a QAbstractScrollArea only.
if (const QWidget *parent = widget->parentWidget()) {
const QString objectName = parent->objectName();
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index 4e9c0ec55..e57d702b0 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -428,7 +428,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#ifndef QT_NO_TOOLBAR
// apply the toolbar's attributes
- else if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
+ if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
mw->addToolBar(toolbarAreaFromDOMAttributes(attributes), toolBar);
// check break
if (const DomProperty *attr = attributes.value(strings.toolBarBreakAttribute))
@@ -441,7 +441,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#ifndef QT_NO_STATUSBAR
// statusBar
- else if (QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget)) {
+ if (QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget)) {
mw->setStatusBar(statusBar);
return true;
}
@@ -449,7 +449,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#ifndef QT_NO_DOCKWIDGET
// apply the dockwidget's attributes
- else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
+ if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
if (const DomProperty *attr = attributes.value(strings.dockWidgetAreaAttribute)) {
Qt::DockWidgetArea area = static_cast<Qt::DockWidgetArea>(attr->elementNumber());
if (!dockWidget->isAreaAllowed(area)) {
@@ -470,7 +470,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
}
#endif
- else if (! mw->centralWidget()) {
+ if (!mw->centralWidget()) {
mw->setCentralWidget(widget);
return true;
}
@@ -568,15 +568,15 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#endif
#ifndef QT_NO_WIZARD
- else if (QWizard *wizard = qobject_cast<QWizard *>(parentWidget)) {
- QWizardPage *page = qobject_cast<QWizardPage*>(widget);
- if (!page) {
- uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Attempt to add child that is not of class QWizardPage to QWizard."));
- return false;
- }
- wizard->addPage(page);
- return true;
- }
+ else if (QWizard *wizard = qobject_cast<QWizard *>(parentWidget)) {
+ QWizardPage *page = qobject_cast<QWizardPage*>(widget);
+ if (!page) {
+ uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Attempt to add child that is not of class QWizardPage to QWizard."));
+ return false;
+ }
+ wizard->addPage(page);
+ return true;
+ }
#endif
return false;
}
@@ -1322,7 +1322,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
for (QObject *obj : qAsConst(children)) {
if (QWidget *childWidget = qobject_cast<QWidget*>(obj)) {
- if (d->m_laidout.contains(childWidget) || recursive == false)
+ if (d->m_laidout.contains(childWidget) || !recursive)
continue;
if (QMenu *menu = qobject_cast<QMenu *>(childWidget)) {
@@ -2525,7 +2525,7 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- if (0) {
+ if (false) {
#ifndef QT_NO_LISTWIDGET
} else if (QListWidget *listWidget = qobject_cast<QListWidget*>(widget)) {
loadListWidgetExtraInfo(ui_widget, listWidget, parentWidget);
diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp
index 8fa340e35..cd891234b 100644
--- a/src/designer/src/lib/uilib/properties.cpp
+++ b/src/designer/src/lib/uilib/properties.cpp
@@ -134,10 +134,9 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
if (!qstrcmp(meta->className(), "QFrame")
&& (pname == QByteArray("orientation"))) {
return QVariant(enumValue == QFormBuilderStrings::instance().horizontalPostFix ? QFrame::HLine : QFrame::VLine);
- } else {
- uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-type property %1 could not be read.").arg(p->attributeName()));
- return QVariant();
}
+ uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-type property %1 could not be read.").arg(p->attributeName()));
+ return QVariant();
}
const QMetaEnum e = meta->property(index).enumerator();