From 215ddbd87838cd2b62e8399a264ea8b60769ed49 Mon Sep 17 00:00:00 2001 From: Claveau Joshua Date: Fri, 18 Sep 2020 11:48:11 +0200 Subject: [PATCH] Minor : minimize code --- sources/factory/propertieseditorfactory.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sources/factory/propertieseditorfactory.cpp b/sources/factory/propertieseditorfactory.cpp index d14a7ea4a..d01407f79 100644 --- a/sources/factory/propertieseditorfactory.cpp +++ b/sources/factory/propertieseditorfactory.cpp @@ -77,26 +77,21 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor( PropertiesEditorWidget *editor, QWidget *parent) { - int count_ = items.size(); + const int count_ = items.size(); + if (count_ == 0) { + return nullptr; + } + QGraphicsItem *item = items.first(); + const int type_ = item->type(); //The editor widget can only edit one item //or several items of the same type - if (count_ != 1) - { - if (count_ == 0) { + for (auto qgi : items) { + if (qgi->type() != type_) { return nullptr; } - - int type_ = items.first()->type(); - for (QGraphicsItem *qgi : items) { - if (qgi->type() != type_) { - return nullptr; - } - } } - QGraphicsItem *item = items.first(); - const int type_ = item->type(); QString class_name; if (editor) { class_name = editor->metaObject()->className();