From f302be8798485858cfac4ca414acfdcfff9b2784 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 30 Jun 2022 23:12:00 +0200 Subject: [PATCH] cleanup: remove dead if-branches In divetooltipitem.cpp, the pointer entryToolTip.first is tested for NULL twice, but it is always initialized in the constructor. This makes no sense - remove the dead code. Signed-off-by: Berthold Stoeger --- profile-widget/divetooltipitem.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp index 6696bfa17..e3584f42b 100644 --- a/profile-widget/divetooltipitem.cpp +++ b/profile-widget/divetooltipitem.cpp @@ -84,12 +84,10 @@ void ToolTipItem::expand() height += sRect.height(); } - if (entryToolTip.first) { - QRectF sRect = entryToolTip.second->boundingRect(); - if (sRect.width() > width) - width = sRect.width(); - height += sRect.height(); - } + QRectF sRect = entryToolTip.second->boundingRect(); + if (sRect.width() > width) + width = sRect.width(); + height += sRect.height(); const int sp2 = iconMetrics.spacing * 2; // pixmap left padding, icon, pixmap right padding, right padding @@ -101,13 +99,9 @@ void ToolTipItem::expand() if (width < title->boundingRect().width() + sp2) width = title->boundingRect().width() + sp2; // clip the height - if (entryToolTip.first) { - const int minH = lrint(entryToolTip.first->y() + entryToolTip.first->pixmap().height() + sp2); - if (height < minH) - height = minH; - } else if (height < iconMetrics.sz_small) { - height = iconMetrics.sz_small; - } + const int minH = lrint(entryToolTip.first->y() + entryToolTip.first->pixmap().height() + sp2); + if (height < minH) + height = minH; nextRectangle.setWidth(width); nextRectangle.setHeight(height);