[Gui] remove some more superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 13:15:38 +02:00
parent af945a8900
commit c40e476a5b
12 changed files with 25 additions and 25 deletions

View File

@@ -1472,7 +1472,7 @@ void StdCmdTransform::activated(int iMsg)
bool StdCmdTransform::isActive(void)
{
return (Gui::Control().activeDialog()==nullptr);
return (Gui::Control().activeDialog() == nullptr);
}
//===========================================================================

View File

@@ -734,7 +734,7 @@ static App::DocumentObject *getSelectedLink(bool finalLink, std::string *subname
}
bool StdCmdLinkSelectLinked::isActive() {
return getSelectedLink(false)!=nullptr;
return getSelectedLink(false) != nullptr;
}
void StdCmdLinkSelectLinked::activated(int)
@@ -779,7 +779,7 @@ StdCmdLinkSelectLinkedFinal::StdCmdLinkSelectLinkedFinal()
}
bool StdCmdLinkSelectLinkedFinal::isActive() {
return getSelectedLink(true)!=nullptr;
return getSelectedLink(true) != nullptr;
}
void StdCmdLinkSelectLinkedFinal::activated(int) {

View File

@@ -162,7 +162,7 @@ void FCCmdTest2::activated(int iMsg)
bool FCCmdTest2::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
//===========================================================================
@@ -192,7 +192,7 @@ void FCCmdTest3::activated(int iMsg)
bool FCCmdTest3::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
//===========================================================================
@@ -223,7 +223,7 @@ void FCCmdTest4::activated(int iMsg)
bool FCCmdTest4::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
//===========================================================================
@@ -252,7 +252,7 @@ void FCCmdTest5::activated(int iMsg)
bool FCCmdTest5::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
@@ -282,7 +282,7 @@ void FCCmdTest6::activated(int iMsg)
bool FCCmdTest6::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
//===========================================================================
@@ -332,7 +332,7 @@ void CmdTestCmdFuncs::activated(int iMsg)
bool CmdTestCmdFuncs::isActive(void)
{
return (getDocument()!=nullptr);
return (getDocument() != nullptr);
}
//===========================================================================

View File

@@ -1942,7 +1942,7 @@ void StdCmdViewCreate::activated(int iMsg)
bool StdCmdViewCreate::isActive(void)
{
return (getActiveGuiDocument()!=nullptr);
return (getActiveGuiDocument() != nullptr);
}
//===========================================================================
@@ -2995,7 +2995,7 @@ bool StdCmdTreeSelectAllInstances::isActive(void)
if(!obj || !obj->getNameInDocument())
return false;
return dynamic_cast<ViewProviderDocumentObject*>(
Application::Instance->getViewProvider(obj))!=nullptr;
Application::Instance->getViewProvider(obj)) != nullptr;
}
void StdCmdTreeSelectAllInstances::activated(int iMsg)
@@ -3170,7 +3170,7 @@ bool StdCmdTextureMapping::isActive(void)
{
Gui::MDIView* view = getMainWindow()->activeWindow();
return view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())
&& (Gui::Control().activeDialog()==nullptr);
&& (Gui::Control().activeDialog() == nullptr);
}
DEF_STD_CMD(StdCmdDemoMode)

View File

@@ -1095,7 +1095,7 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
void Model::onRenameSlot()
{
assert(proxy == nullptr);
assert(!proxy);
std::vector<Gui::DAG::Vertex> selections = getAllSelected();
assert(selections.size() == 1);

View File

@@ -51,7 +51,7 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path,
, impliedUnit(_impliedUnit)
, minimumWidth(10)
{
assert(path.getDocumentObject() != nullptr);
assert(path.getDocumentObject());
// Setup UI
ui->setupUi(this);

View File

@@ -238,7 +238,7 @@ bool ExpressionBinding::apply()
{
Property * prop(path.getProperty());
assert(prop != nullptr);
assert(prop);
Q_UNUSED(prop);
DocumentObject * docObj(path.getDocumentObject());

View File

@@ -878,7 +878,7 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
{
if (this->log.historysize < 2)
return;
assert(this->spinprojector != nullptr);
assert(this->spinprojector);
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
SbVec2s glsize(vp.getViewportSizePixels());
@@ -956,7 +956,7 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
* \param prevpos previous normalized position of mouse pointer
*/
void NavigationStyle::spin_simplified(SoCamera* cam, SbVec2f curpos, SbVec2f prevpos){
assert(this->spinprojector != nullptr);
assert(this->spinprojector);
// 0000333: Turntable camera rotation
SbMatrix mat;

View File

@@ -43,7 +43,7 @@ QuarterP::QuarterP()
{
this->sensormanager = new SensorManager;
this->imagereader = new ImageReader;
assert(QuarterP::statecursormap == nullptr);
assert(!QuarterP::statecursormap);
QuarterP::statecursormap = new StateCursorMap;
}
@@ -53,7 +53,7 @@ QuarterP::~QuarterP()
delete this->imagereader;
delete this->sensormanager;
assert(QuarterP::statecursormap != nullptr);
assert(QuarterP::statecursormap);
delete QuarterP::statecursormap;
// FIXME: Why not use an atexit mechanism for this?

View File

@@ -68,7 +68,7 @@ SoFCOffscreenRenderer* SoFCOffscreenRenderer::inst = nullptr;
SoFCOffscreenRenderer& SoFCOffscreenRenderer::instance()
{
if (inst==nullptr)
if (!inst)
inst = new SoFCOffscreenRenderer(SbViewportRegion());
return *inst;
}

View File

@@ -165,9 +165,9 @@ RotTransDragger::RotTransDragger()
RotTransDragger::~RotTransDragger()
{
if (rotFieldSensor!=nullptr)
if (rotFieldSensor)
delete rotFieldSensor;
if (translFieldSensor!=nullptr)
if (translFieldSensor)
delete translFieldSensor;
}
@@ -315,9 +315,9 @@ RotTransDragger::setUpConnections(SbBool onOff, SbBool doItAlways)
unregisterChildDragger(ZD);
// Disconnect the field sensors.
if (translFieldSensor->getAttachedField()!=nullptr)
if (translFieldSensor->getAttachedField())
translFieldSensor->detach();
if (rotFieldSensor->getAttachedField()!=nullptr)
if (rotFieldSensor->getAttachedField())
rotFieldSensor->detach();
SoDragger::setUpConnections(onOff, doItAlways);

View File

@@ -128,7 +128,7 @@ Py::Object ControlPy::activeDialog(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
return Py::Boolean(dlg!=nullptr);
return Py::Boolean(dlg != nullptr);
}
Py::Object ControlPy::closeDialog(const Py::Tuple& args)