Skip to content

Commit 6c7fc2a

Browse files
committed
gui: avoid else after return in displayControls
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
1 parent 858ff90 commit 6c7fc2a

1 file changed

Lines changed: 28 additions & 24 deletions

File tree

src/gui/src/displayControls.cpp

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,37 +1001,41 @@ std::tuple<QColor*, Qt::BrushStyle*, bool> DisplayControls::lookupColor(
10011001
{
10021002
if (item == misc_.background.swatch) {
10031003
return {&background_color_, nullptr, false};
1004-
} else if (item == blockages_.blockages.swatch) {
1004+
}
1005+
if (item == blockages_.blockages.swatch) {
10051006
return {&placement_blockage_color_, &placement_blockage_pattern_, false};
1006-
} else if (item == misc_.regions.swatch) {
1007+
}
1008+
if (item == misc_.regions.swatch) {
10071009
return {&region_color_, &region_pattern_, false};
1008-
} else if (item == instance_shapes_.names.swatch) {
1010+
}
1011+
if (item == instance_shapes_.names.swatch) {
10091012
return {&instance_name_color_, nullptr, false};
1010-
} else if (item == instance_shapes_.iterm_labels.swatch) {
1013+
}
1014+
if (item == instance_shapes_.iterm_labels.swatch) {
10111015
return {&iterm_label_color_, nullptr, false};
1012-
} else if (item == rulers_.swatch) {
1016+
}
1017+
if (item == rulers_.swatch) {
10131018
return {&ruler_color_, nullptr, false};
1014-
} else {
1015-
QVariant tech_layer_data = item->data(user_data_item_idx_);
1016-
if (!tech_layer_data.isValid()) {
1017-
return {nullptr, nullptr, false};
1018-
}
1019-
auto tech_layer = tech_layer_data.value<dbTechLayer*>();
1020-
auto site = tech_layer_data.value<odb::dbSite*>();
1021-
if (tech_layer != nullptr) {
1022-
QColor* item_color = &layer_color_[tech_layer];
1023-
Qt::BrushStyle* item_pattern = &layer_pattern_[tech_layer];
1024-
if (tech_layer->getType() != dbTechLayerType::ROUTING) {
1025-
if (index && index->row() != 0) {
1026-
// ensure if a via is the first layer, it can still be modified
1027-
return {item_color, item_pattern, false};
1028-
}
1029-
} else {
1030-
return {item_color, item_pattern, true};
1019+
}
1020+
QVariant tech_layer_data = item->data(user_data_item_idx_);
1021+
if (!tech_layer_data.isValid()) {
1022+
return {nullptr, nullptr, false};
1023+
}
1024+
auto tech_layer = tech_layer_data.value<dbTechLayer*>();
1025+
auto site = tech_layer_data.value<odb::dbSite*>();
1026+
if (tech_layer != nullptr) {
1027+
QColor* item_color = &layer_color_[tech_layer];
1028+
Qt::BrushStyle* item_pattern = &layer_pattern_[tech_layer];
1029+
if (tech_layer->getType() != dbTechLayerType::ROUTING) {
1030+
if (index && index->row() != 0) {
1031+
// ensure if a via is the first layer, it can still be modified
1032+
return {item_color, item_pattern, false};
10311033
}
1032-
} else if (site != nullptr) {
1033-
return {&site_color_[site], nullptr, false};
1034+
} else {
1035+
return {item_color, item_pattern, true};
10341036
}
1037+
} else if (site != nullptr) {
1038+
return {&site_color_[site], nullptr, false};
10351039
}
10361040

10371041
return {nullptr, nullptr, false};

0 commit comments

Comments
 (0)