[TD] last part of removal of superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-20 12:17:16 +02:00
parent b81d7e4864
commit b2bb479788
8 changed files with 75 additions and 121 deletions

View File

@@ -259,10 +259,8 @@ void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF>
// points.size());
m_blockDraw = true;
auto featLeader = getFeature();
if (featLeader == nullptr) {
//tarfu
if (!featLeader)
return;
}
double baseScale = featLeader->getBaseScale();
if ( !(TechDraw::DrawUtil::fpCompare(tipDisplace.x(),0.0) &&
@@ -299,9 +297,8 @@ void QGILeaderLine::startPathEdit(void)
{
saveState();
auto featLeader( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
if (featLeader == nullptr) {
if (!featLeader)
return;
}
double scale = featLeader->getScale();
m_editPath->setScale(scale);
@@ -346,46 +343,38 @@ void QGILeaderLine::updateView(bool update)
}
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
if ( vp == nullptr ) {
if (!vp)
return;
}
draw();
}
void QGILeaderLine::draw()
{
// Base::Console().Message("QGILL::draw()- %s\n", getViewObject()->getNameInDocument());
if (m_blockDraw) {
if (m_blockDraw)
return;
}
if (!isVisible()) {
if (!isVisible())
return;
}
TechDraw::DrawLeaderLine* featLeader = getFeature();
if((!featLeader) ) {
if (!featLeader)
return;
}
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
if ( vp == nullptr ) {
if (!vp)
return;
}
double scale = 1.0;
TechDraw::DrawView* parent = featLeader->getBaseView();
if (parent) {
if (parent)
scale = parent->getScale();
}
if (m_editPath->inEdit()) {
if (m_editPath->inEdit())
return;
}
//********
if (featLeader->isLocked()) {
if (featLeader->isLocked())
setFlag(QGraphicsItem::ItemIsMovable, false);
} else {
else
setFlag(QGraphicsItem::ItemIsMovable, true);
}
m_lineStyle = (Qt::PenStyle) vp->LineStyle.getValue();
double baseScale = featLeader->getBaseScale();
@@ -427,7 +416,7 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
// Base::Console().Message("QGILeaderLine::makeLeaderPath()\n");
QPainterPath result;
DrawLeaderLine* featLeader = getFeature();
if (featLeader == nullptr) {
if (!featLeader) {
Base::Console().Message("QGILL::makeLeaderPath - featLeader is nullptr\n");
return result;
}
@@ -489,7 +478,7 @@ std::vector<QPointF> QGILeaderLine::getWayPointsFromFeature(void)
std::vector<QPointF> qPoints;
DrawLeaderLine* featLeader = getFeature();
if (featLeader == nullptr) {
if (!featLeader) {
Base::Console().Message("QGILL::getWayPointsFromFeature - featLeader is nullptr\n");
return qPoints;
}
@@ -576,9 +565,8 @@ void QGILeaderLine::abandonEdit(void)
double QGILeaderLine::getLineWidth(void)
{
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
if ( vp == nullptr ) {
if (!vp)
return Rez::guiX(LineGroup::getDefaultWidth("Graphic"));
}
return Rez::guiX(vp->LineWidth.getValue());
}
@@ -600,16 +588,14 @@ QColor QGILeaderLine::getNormalColor()
m_colNormal = PreferencesGui::leaderQColor();
auto lead( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
if (!lead) {
if (!lead)
// Base::Console().Message("QGILL::getNormalColor - no feature\n");
return m_colNormal;
}
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
if ( vp == nullptr ) {
if (!vp)
// Base::Console().Message("QGILL::getNormalColor - no viewProvider\n");
return m_colNormal;
}
m_colNormal = vp->Color.getValue().asValue<QColor>();
return m_colNormal;