mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-28 22:09:59 +01:00
Minor : minimize code
This commit is contained in:
@@ -77,26 +77,21 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
|
|||||||
PropertiesEditorWidget *editor,
|
PropertiesEditorWidget *editor,
|
||||||
QWidget *parent)
|
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
|
//The editor widget can only edit one item
|
||||||
//or several items of the same type
|
//or several items of the same type
|
||||||
if (count_ != 1)
|
for (auto qgi : items) {
|
||||||
{
|
if (qgi->type() != type_) {
|
||||||
if (count_ == 0) {
|
|
||||||
return nullptr;
|
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;
|
QString class_name;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
class_name = editor->metaObject()->className();
|
class_name = editor->metaObject()->className();
|
||||||
|
|||||||
Reference in New Issue
Block a user