[TD] remove more superfluous nullptr checks
This commit is contained in:
@@ -710,7 +710,7 @@ private:
|
||||
} else if (v->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) {
|
||||
DrawViewDimension* dvd = static_cast<TechDraw::DrawViewDimension*>(v);
|
||||
TechDraw::DrawViewPart* dvp = dvd->getViewPart();
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp) {
|
||||
continue;
|
||||
}
|
||||
double grandParentX = 0.0;
|
||||
@@ -718,7 +718,7 @@ private:
|
||||
if (dvp->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
|
||||
TechDraw::DrawProjGroupItem* dpgi = static_cast<TechDraw::DrawProjGroupItem*>(dvp);
|
||||
TechDraw::DrawProjGroup* dpg = dpgi->getPGroup();
|
||||
if (dpg == nullptr) {
|
||||
if (!dpg) {
|
||||
continue;
|
||||
}
|
||||
grandParentX = dpg->X.getValue();
|
||||
|
||||
@@ -1254,7 +1254,7 @@ void CenterLine::Save(Base::Writer &writer) const
|
||||
writer.Stream() << writer.ind() << "<Visible value=\"" << v << "\"/>" << endl;
|
||||
|
||||
//stored geometry
|
||||
if (m_geometry == nullptr) {
|
||||
if (!m_geometry) {
|
||||
return Base::Console().Error("CL::Save - m_geometry is null\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ void CosmeticEdgePy::setCenter(Py::Object arg)
|
||||
pNew = DrawUtil::invertY(pNew);
|
||||
auto oldGeom = getCosmeticEdgePtr()->m_geometry;
|
||||
TechDraw::CirclePtr oldCircle = std::dynamic_pointer_cast<TechDraw::Circle> (oldGeom);
|
||||
if (oldCircle == nullptr) {
|
||||
if (!oldCircle) {
|
||||
throw Py::TypeError("Edge geometry is not a circle");
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
|
||||
}
|
||||
|
||||
App::DocumentObject* base = BaseView.getValue();
|
||||
if (base == nullptr) {
|
||||
if (!base) {
|
||||
return new App::DocumentObjectExecReturn("BaseView object not found");
|
||||
}
|
||||
|
||||
|
||||
@@ -494,7 +494,7 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
||||
}
|
||||
|
||||
base = BaseGeom::baseFactory(edge);
|
||||
if (base == nullptr) {
|
||||
if (!base) {
|
||||
Base::Console().Log("Error - GO::addGeomFromCompound - baseFactory failed for edge: %d\n",i);
|
||||
continue;
|
||||
// throw Base::ValueError("GeometryObject::addGeomFromCompound - baseFactory failed");
|
||||
|
||||
@@ -108,7 +108,7 @@ App::DocumentObjectExecReturn *LandmarkDimension::execute(void)
|
||||
}
|
||||
|
||||
DrawViewPart* dvp = getViewPart();
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
References2D.setValue(dvp);
|
||||
|
||||
@@ -161,7 +161,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getXShapes(const App::Link* xLink)
|
||||
{
|
||||
// Base::Console().Message("SE::getXShapes(%X) - %s\n", xLink, xLink->getNameInDocument());
|
||||
std::vector<TopoDS_Shape> xSourceShapes;
|
||||
if (xLink == nullptr) {
|
||||
if (!xLink) {
|
||||
return xSourceShapes;
|
||||
}
|
||||
|
||||
|
||||
@@ -876,7 +876,7 @@ void CmdTechDrawBalloon::activated(int iMsg)
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
|
||||
auto objFeat(dynamic_cast<TechDraw::DrawViewPart*>(selection[0].getObject()));
|
||||
if (objFeat == nullptr) {
|
||||
if (!objFeat) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1266,7 +1266,7 @@ void CmdTechDrawArchView::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
if (archObject == nullptr) {
|
||||
if (!archObject) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("No Arch Sections in selection."));
|
||||
return;
|
||||
|
||||
@@ -517,7 +517,7 @@ void CmdTechDrawQuadrants::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -596,7 +596,7 @@ void CmdTechDrawCenterLineGroup::activated(int iMsg)
|
||||
{
|
||||
// Base::Console().Message("CMD::CenterLineGroup - activated(%d)\n", iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -700,7 +700,7 @@ void CmdTechDrawFaceCenterLine::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -724,18 +724,19 @@ void execCenterLine(Gui::Command* cmd)
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = cmd->getSelection().getSelectionEx();
|
||||
TechDraw::DrawViewPart* baseFeat = nullptr;
|
||||
TechDraw::DrawViewPart *baseFeat = nullptr;
|
||||
if (!selection.empty()) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject());
|
||||
if( baseFeat == nullptr ) {
|
||||
baseFeat = dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject());
|
||||
if (!baseFeat) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("No base View in Selection."));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("You must select a base View for the line."));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("You must select a base View for the line."));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> subNames;
|
||||
@@ -775,7 +776,7 @@ void execCenterLine(Gui::Command* cmd)
|
||||
return;
|
||||
} else {
|
||||
TechDraw::CenterLine* cl = baseFeat->getCenterLineBySelection(edgeNames.front());
|
||||
if (cl == nullptr) {
|
||||
if (!cl) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a CenterLine."));
|
||||
return;
|
||||
@@ -810,7 +811,7 @@ void CmdTechDraw2LineCenterLine::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -835,8 +836,7 @@ void exec2LineCenterLine(Gui::Command* cmd)
|
||||
TechDraw::DrawViewPart* dvp = nullptr;
|
||||
std::vector<std::string> selectedEdges = getSelectedSubElements(cmd, dvp, "Edge");
|
||||
|
||||
if ( (dvp == nullptr) ||
|
||||
(selectedEdges.empty()) ) {
|
||||
if (!dvp || selectedEdges.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ void exec2LineCenterLine(Gui::Command* cmd)
|
||||
false));
|
||||
} else if (selectedEdges.size() == 1) {
|
||||
TechDraw::CenterLine* cl = dvp->getCenterLineBySelection(selectedEdges.front());
|
||||
if (cl == nullptr) {
|
||||
if (!cl) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a CenterLine."));
|
||||
return;
|
||||
@@ -886,7 +886,7 @@ void CmdTechDraw2PointCenterLine::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -920,7 +920,7 @@ void exec2PointCenterLine(Gui::Command* cmd)
|
||||
}
|
||||
|
||||
baseFeat = dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject());
|
||||
if( baseFeat == nullptr ) {
|
||||
if (!baseFeat) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("No base View in Selection."));
|
||||
return;
|
||||
@@ -959,7 +959,7 @@ void exec2PointCenterLine(Gui::Command* cmd)
|
||||
false));
|
||||
} else if (!edgeNames.empty() && (edgeNames.size() == 1)) {
|
||||
TechDraw::CenterLine* cl = baseFeat->getCenterLineBySelection(edgeNames.front());
|
||||
if (cl == nullptr) {
|
||||
if (!cl) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a CenterLine."));
|
||||
return;
|
||||
@@ -999,7 +999,7 @@ void CmdTechDraw2PointCosmeticLine::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1080,7 +1080,7 @@ void execLine2Points(Gui::Command* cmd)
|
||||
//check if editing existing edge
|
||||
if (!edgeNames.empty() && (edgeNames.size() == 1)) {
|
||||
TechDraw::CosmeticEdge* ce = baseFeat->getCosmeticEdgeBySelection(edgeNames.front());
|
||||
if (ce == nullptr) {
|
||||
if (!ce) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a Cosmetic Line."));
|
||||
return;
|
||||
@@ -1154,7 +1154,7 @@ void CmdTechDrawCosmeticEraser::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1190,7 +1190,7 @@ void CmdTechDrawCosmeticEraser::activated(int iMsg)
|
||||
objFeat = static_cast<TechDraw::DrawViewPart*> ((*itSel).getObject());
|
||||
subNames = (*itSel).getSubNames();
|
||||
}
|
||||
if (objFeat == nullptr) {
|
||||
if (!objFeat) {
|
||||
break;
|
||||
}
|
||||
std::vector<std::string> cv2Delete;
|
||||
@@ -1275,7 +1275,7 @@ void CmdTechDrawDecorateLine::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1353,7 +1353,7 @@ void CmdTechDrawShowAll::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1373,7 +1373,7 @@ void CmdTechDrawShowAll::activated(int iMsg)
|
||||
}
|
||||
|
||||
baseFeat = dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject());
|
||||
if (baseFeat == nullptr) {
|
||||
if (!baseFeat) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("No Part Views in this selection"));
|
||||
return;
|
||||
@@ -1419,7 +1419,7 @@ void CmdTechDrawWeldSymbol::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
|
||||
@@ -103,7 +103,7 @@ void CmdTechDrawHatch::activated(int iMsg)
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
auto partFeat( dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject()) );
|
||||
if( partFeat == nullptr ) {
|
||||
if (!partFeat) {
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string> &subNames = selection[0].getSubNames();
|
||||
@@ -201,7 +201,7 @@ void CmdTechDrawGeometricHatch::activated(int iMsg)
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
auto objFeat( dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject()) );
|
||||
if( objFeat == nullptr ) {
|
||||
if (!objFeat) {
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string> &subNames = selection[0].getSubNames();
|
||||
@@ -326,7 +326,7 @@ void CmdTechDrawToggleFrame::activated(int iMsg)
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(page);
|
||||
ViewProviderPage* vpp = dynamic_cast<ViewProviderPage*>(vp);
|
||||
|
||||
if (vpp == nullptr) {
|
||||
if (!vpp) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No TechDraw Page"),
|
||||
QObject::tr("Need a TechDraw Page for this command"));
|
||||
return;
|
||||
|
||||
@@ -2260,7 +2260,7 @@ namespace TechDrawGui {
|
||||
// check selection of getSelectionEx() and selection[0].getObject()
|
||||
if (_checkSelection(cmd, selection, message)) {
|
||||
objFeat = dynamic_cast<TechDraw::DrawViewPart*>(selection[0].getObject());
|
||||
if (objFeat == nullptr) {
|
||||
if (!objFeat) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr(message.c_str()),
|
||||
QObject::tr("No object selected"));
|
||||
|
||||
@@ -283,7 +283,7 @@ CmdTechDrawExtensionCircleCenterLinesGroup::CmdTechDrawExtensionCircleCenterLine
|
||||
|
||||
void CmdTechDrawExtensionCircleCenterLinesGroup::activated(int iMsg) {
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -590,7 +590,7 @@ void CmdTechDrawExtensionThreadsGroup::activated(int iMsg)
|
||||
{
|
||||
// Base::Console().Message("CMD::TechDrawExtensionThreadsGroup - activated(%d)\n", iMsg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -766,7 +766,7 @@ void CmdTechDrawExtensionChangeLineAttributes::activated(int iMsg) {
|
||||
for (std::string name : subNames) {
|
||||
int num = DrawUtil::getIndexFromName(name);
|
||||
BaseGeomPtr baseGeo = objFeat->getGeomByIndex(num);
|
||||
if (baseGeo != nullptr) {
|
||||
if (baseGeo) {
|
||||
if (baseGeo->cosmetic) {
|
||||
if (baseGeo->source() == 1) {
|
||||
TechDraw::CosmeticEdge* cosEdgeTag = objFeat->getCosmeticEdgeBySelection(name);
|
||||
@@ -1068,7 +1068,7 @@ void CmdTechDrawExtensionDrawCirclesGroup::activated(int iMsg)
|
||||
{
|
||||
// Base::Console().Message("CMD::ExtensionDrawCirclesGroup - activated(%d)\n", iMsg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1299,7 +1299,7 @@ void CmdTechDrawExtensionLinePPGroup::activated(int iMsg)
|
||||
{
|
||||
// Base::Console().Message("CMD::ExtensionLinePPGroup - activated(%d)\n", iMsg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1506,7 +1506,7 @@ void execExtendShortenLine(Gui::Command* cmd, bool extend) {
|
||||
std::string geoType = TechDraw::DrawUtil::getGeomTypeFromName(name);
|
||||
if (geoType == "Edge") {
|
||||
TechDraw::BaseGeomPtr baseGeo = objFeat->getGeomByIndex(num);
|
||||
if (baseGeo != nullptr) {
|
||||
if (baseGeo) {
|
||||
if (baseGeo->geomType == TechDraw::GENERIC) {
|
||||
TechDraw::GenericPtr genLine = std::static_pointer_cast<TechDraw::Generic>(baseGeo);
|
||||
Base::Vector3d P0 = genLine->points.at(0);
|
||||
@@ -1653,7 +1653,7 @@ void CmdTechDrawExtendShortenLineGroup::activated(int iMsg)
|
||||
{
|
||||
// Base::Console().Message("CMD::ExtendShortenLineGroup - activated(%d)\n", iMsg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
if (dlg) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
@@ -1910,7 +1910,7 @@ namespace TechDrawGui {
|
||||
}
|
||||
|
||||
objFeat = dynamic_cast<TechDraw::DrawViewPart*>(selection[0].getObject());
|
||||
if (objFeat == nullptr) {
|
||||
if (!objFeat) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr(message.c_str()),
|
||||
QObject::tr("No object selected"));
|
||||
|
||||
@@ -79,19 +79,19 @@ double Grabber3d::copyActiveViewToSvgFile(App::Document* appDoc,
|
||||
//get the active view
|
||||
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(appDoc);
|
||||
Gui::MDIView* mdiView = guiDoc->getActiveView();
|
||||
if (mdiView == nullptr) {
|
||||
if (!mdiView) {
|
||||
Base::Console().Warning("G3d::copyActiveViewToSvgFile - no ActiveView - returning\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
View3DInventor* view3d = qobject_cast<View3DInventor*>(mdiView);
|
||||
if (view3d == nullptr) {
|
||||
if (!view3d) {
|
||||
Base::Console().Warning("G3d::copyActiveViewToSvgFile - no viewer for ActiveView - returning\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
View3DInventorViewer* viewer = view3d->getViewer();
|
||||
if (viewer == nullptr) {
|
||||
if (!viewer) {
|
||||
Base::Console().Warning("G3d::copyActiveViewToSvgFile - could not create viewer - returning\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ void MDIViewPage::fixOrphans(bool force)
|
||||
continue;
|
||||
}
|
||||
QGIView* qv = m_scene->findQViewForDocObj(dv);
|
||||
if (qv == nullptr) {
|
||||
if (!qv) {
|
||||
attachView(dv);
|
||||
}
|
||||
}
|
||||
@@ -490,7 +490,7 @@ void MDIViewPage::fixOrphans(bool force)
|
||||
if (!qv)
|
||||
continue; // already deleted?
|
||||
App::DocumentObject* obj = doc->getObject(qv->getViewName());
|
||||
if (obj == nullptr) {
|
||||
if (!obj) {
|
||||
//no DrawView anywhere in Document
|
||||
m_scene->removeQView(qv);
|
||||
} else {
|
||||
@@ -1019,11 +1019,11 @@ void MDIViewPage::clearSceneSelection()
|
||||
|
||||
//handle oddballs
|
||||
QGIViewDimension* dim = dynamic_cast<QGIViewDimension*>(*it);
|
||||
if (dim != nullptr) {
|
||||
if (dim) {
|
||||
state = dim->getDatumLabel()->isSelected();
|
||||
} else {
|
||||
QGIViewBalloon* bal = dynamic_cast<QGIViewBalloon*>(*it);
|
||||
if (bal != nullptr) {
|
||||
if (bal) {
|
||||
state = bal->getBalloonLabel()->isSelected();
|
||||
}
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ void MDIViewPage::setTreeToSceneSelect(void)
|
||||
QList<QGraphicsItem*> sceneSel = m_qgSceneSelected;
|
||||
for (QList<QGraphicsItem*>::iterator it = sceneSel.begin(); it != sceneSel.end(); ++it) {
|
||||
QGIView *itemView = dynamic_cast<QGIView *>(*it);
|
||||
if(itemView == nullptr) {
|
||||
if (!itemView) {
|
||||
QGIEdge *edge = dynamic_cast<QGIEdge *>(*it);
|
||||
if(edge) {
|
||||
QGraphicsItem*parent = edge->parentItem();
|
||||
@@ -1330,25 +1330,27 @@ bool MDIViewPage::compareSelections(std::vector<Gui::SelectionObject> treeSel, Q
|
||||
std::sort(treeNames.begin(),treeNames.end());
|
||||
treeCount = treeNames.size();
|
||||
|
||||
for (auto sn:sceneSel){
|
||||
for (auto sn : sceneSel) {
|
||||
QGIView *itemView = dynamic_cast<QGIView *>(sn);
|
||||
if(itemView == nullptr) {
|
||||
QGIDatumLabel* dl = dynamic_cast<QGIDatumLabel*>(sn);
|
||||
QGIPrimPath* pp = dynamic_cast<QGIPrimPath*>(sn); //count Vertex/Edge/Face
|
||||
if (pp != nullptr) {
|
||||
if (!itemView) {
|
||||
QGIDatumLabel *dl = dynamic_cast<QGIDatumLabel *>(sn);
|
||||
QGIPrimPath *pp = dynamic_cast<QGIPrimPath *>(sn);//count Vertex/Edge/Face
|
||||
if (pp) {
|
||||
ppCount++;
|
||||
} else if (dl != nullptr) {
|
||||
}
|
||||
else if (dl) {
|
||||
//get dim associated with this label
|
||||
QGraphicsItem* qgi = dl->parentItem();
|
||||
if (qgi != nullptr) {
|
||||
QGIViewDimension* vd = dynamic_cast<QGIViewDimension*>(qgi);
|
||||
if (vd != nullptr) {
|
||||
QGraphicsItem *qgi = dl->parentItem();
|
||||
if (qgi) {
|
||||
QGIViewDimension *vd = dynamic_cast<QGIViewDimension *>(qgi);
|
||||
if (vd) {
|
||||
std::string s = vd->getViewNameAsString();
|
||||
sceneNames.push_back(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
std::string s = itemView->getViewNameAsString();
|
||||
sceneNames.push_back(s);
|
||||
}
|
||||
@@ -1397,7 +1399,7 @@ void MDIViewPage::showStatusMsg(const char* s1, const char* s2, const char* s3)
|
||||
//return the MDIViewPage that owns the scene
|
||||
MDIViewPage *MDIViewPage::getFromScene(const QGSPage *scene)
|
||||
{
|
||||
if (scene != nullptr && scene->parent() != nullptr) {
|
||||
if (scene && scene->parent()) {
|
||||
return dynamic_cast<MDIViewPage *>(scene->parent());
|
||||
}
|
||||
|
||||
|
||||
@@ -347,13 +347,13 @@ void QGEPath::onEndEdit(void)
|
||||
std::vector<QPointF> QGEPath::getDeltasFromLeader(void)
|
||||
{
|
||||
std::vector<QPointF> qDeltas;
|
||||
if (m_parentLeader == nullptr) {
|
||||
if (!m_parentLeader) {
|
||||
Base::Console().Message("QGEP::getDeltasFromLeader - m_parentLeader is nullptr\n");
|
||||
return qDeltas;
|
||||
}
|
||||
|
||||
DrawLeaderLine* featLeader = m_parentLeader->getFeature();
|
||||
if (featLeader == nullptr) {
|
||||
if (!featLeader) {
|
||||
Base::Console().Message("QGEP::getDeltasFromLeader - featLeader is nullptr\n");
|
||||
return qDeltas;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ void QGEPath::updateParent(void)
|
||||
void QGEPath::drawGhost(void)
|
||||
{
|
||||
// Base::Console().Message("QGEPath::drawGhost()\n");
|
||||
if (m_ghost->scene() == nullptr) {
|
||||
if (!m_ghost->scene()) {
|
||||
m_ghost->setParentItem(this);
|
||||
}
|
||||
QPainterPath qpp;
|
||||
|
||||
@@ -201,7 +201,7 @@ void QGILeaderLine::onSourceChange(TechDraw::DrawView* newParent)
|
||||
// Base::Console().Message("QGILL::onSoureChange(%s)\n",newParent->getNameInDocument());
|
||||
std::string parentName = newParent->getNameInDocument();
|
||||
QGIView* qgiParent = getQGIVByName(parentName);
|
||||
if (qgiParent != nullptr) {
|
||||
if (qgiParent) {
|
||||
m_parentItem = qgiParent;
|
||||
setParentItem(m_parentItem);
|
||||
draw();
|
||||
@@ -246,7 +246,7 @@ void QGILeaderLine::setPrettySel() {
|
||||
void QGILeaderLine::closeEdit(void)
|
||||
{
|
||||
// Base::Console().Message("QGIL::closeEdit()\n");
|
||||
if (m_editPath != nullptr) {
|
||||
if (m_editPath) {
|
||||
m_editPath->onEndEdit(); //tell QEPath that edit session ended
|
||||
}
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void QGILeaderLine::saveState(void)
|
||||
{
|
||||
// Base::Console().Message("QGILL::saveState()\n");
|
||||
auto featLeader = getFeature();
|
||||
if (featLeader != nullptr) {
|
||||
if (featLeader) {
|
||||
m_savePoints = featLeader->WayPoints.getValues();
|
||||
m_saveX = featLeader->X.getValue();
|
||||
m_saveY = featLeader->Y.getValue();
|
||||
@@ -325,7 +325,7 @@ void QGILeaderLine::restoreState(void)
|
||||
{
|
||||
// Base::Console().Message("QGILL::restoreState()\n");
|
||||
auto featLeader = getFeature();
|
||||
if (featLeader != nullptr) {
|
||||
if (featLeader) {
|
||||
featLeader->WayPoints.setValues(m_savePoints);
|
||||
featLeader->X.setValue(m_saveX);
|
||||
featLeader->Y.setValue(m_saveY);
|
||||
@@ -372,7 +372,7 @@ void QGILeaderLine::draw()
|
||||
|
||||
double scale = 1.0;
|
||||
TechDraw::DrawView* parent = featLeader->getBaseView();
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
scale = parent->getScale();
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,13 @@ QColor QGIPrimPath::getNormalColor()
|
||||
}
|
||||
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent == nullptr) {
|
||||
if (!qparent) {
|
||||
parent = nullptr;
|
||||
} else {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
}
|
||||
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
result = parent->getNormalColor();
|
||||
} else {
|
||||
result = PreferencesGui::normalQColor();
|
||||
@@ -177,13 +177,13 @@ QColor QGIPrimPath::getPreColor()
|
||||
QColor result;
|
||||
QGIView *parent;
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent == nullptr) {
|
||||
if (!qparent) {
|
||||
parent = nullptr;
|
||||
} else {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
}
|
||||
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
result = parent->getPreColor();
|
||||
} else {
|
||||
result = PreferencesGui::preselectQColor();
|
||||
@@ -196,13 +196,13 @@ QColor QGIPrimPath::getSelectColor()
|
||||
QColor result;
|
||||
QGIView *parent;
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent == nullptr) {
|
||||
if (!qparent) {
|
||||
parent = nullptr;
|
||||
} else {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
}
|
||||
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
result = parent->getSelectColor();
|
||||
} else {
|
||||
result = PreferencesGui::selectQColor();
|
||||
@@ -279,9 +279,9 @@ void QGIPrimPath::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
//wf: this seems a bit of a hack. does it mess up selection of QGIPP??
|
||||
QGIView *parent;
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent != nullptr) {
|
||||
if (qparent) {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
// Base::Console().Message("QGIPP::mousePressEvent - passing event to QGIV parent\n");
|
||||
parent->mousePressEvent(event);
|
||||
} else {
|
||||
|
||||
@@ -180,7 +180,7 @@ QGIView * QGIProjGroup::getAnchorQItem() const
|
||||
// Get the currently assigned anchor view
|
||||
App::DocumentObject *anchorObj = getDrawView()->Anchor.getValue();
|
||||
auto anchorView( dynamic_cast<TechDraw::DrawView *>(anchorObj) );
|
||||
if( anchorView == nullptr ) {
|
||||
if (!anchorView) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ void ViewProviderPage::removeMDIView(void)
|
||||
|
||||
Gui::getMainWindow()->removeWindow(m_mdiView);
|
||||
Gui::MDIView* aw = Gui::getMainWindow()->activeWindow(); //WF: this bit should be in the remove window logic, not here.
|
||||
if (aw == nullptr) {
|
||||
if (!aw) {
|
||||
return;
|
||||
}
|
||||
aw->showMaximized();
|
||||
@@ -338,7 +338,7 @@ std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
||||
//DrawRichAnno with no parent is child of Page
|
||||
TechDraw::DrawRichAnno* dra = dynamic_cast<TechDraw::DrawRichAnno*> (*it);
|
||||
if (dra) {
|
||||
if (dra->AnnoParent.getValue() == nullptr) {
|
||||
if (!dra->AnnoParent.getValue()) {
|
||||
temp.push_back(*it); //no parent, belongs to page
|
||||
}
|
||||
continue; //has a parent somewhere else
|
||||
|
||||
Reference in New Issue
Block a user