From 48af57374609531fe71c99dbb1eba0ab054ba658 Mon Sep 17 00:00:00 2001 From: Uwe Date: Mon, 18 Jul 2022 02:34:57 +0200 Subject: [PATCH] [FEM] remove more superfluous nullptr checks --- src/Mod/Fem/Gui/Command.cpp | 2 +- src/Mod/Fem/Gui/TaskPostBoxes.cpp | 4 ++-- src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp | 14 +++++++------- .../Fem/Gui/ViewProviderFemConstraintBearing.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp | 2 +- .../Gui/ViewProviderFemConstraintFluidBoundary.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp | 2 +- .../Fem/Gui/ViewProviderFemConstraintPulley.cpp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 7a1fa85c95..113eab5a83 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -1675,7 +1675,7 @@ void CmdFemPostFunctions::activated(int iMsg) this->updateActive(); //most of the times functions are added inside of a filter, make sure this still works - if (Gui::Application::Instance->activeDocument()->getInEdit() == nullptr) + if (!Gui::Application::Instance->activeDocument()->getInEdit()) doCommand(Gui, "Gui.activeDocument().setEdit('%s')", FeatName.c_str()); } else { diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index f12f7fe355..2bd5b7162d 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -830,7 +830,7 @@ void TaskPostDataAlongLine::pointCallback(void* ud, SoEventCallback* n) if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { const SoPickedPoint* point = n->getPickedPoint(); - if (point == nullptr) { + if (!point) { Base::Console().Message("No point picked.\n"); return; } @@ -1059,7 +1059,7 @@ void TaskPostDataAtPoint::pointCallback(void* ud, SoEventCallback* n) if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { const SoPickedPoint* point = n->getPickedPoint(); - if (point == nullptr) { + if (!point) { Base::Console().Message("No point picked.\n"); return; } diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp index 40efb0ea34..18ccfee64a 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp @@ -502,25 +502,25 @@ void ViewProviderFemConstraint::checkForWizard() wizardWidget= nullptr; wizardSubLayout = nullptr; Gui::MainWindow* mw = Gui::getMainWindow(); - if (mw == nullptr) + if (!mw) return; QDockWidget* dw = mw->findChild(QString::fromLatin1("Combo View")); - if (dw == nullptr) + if (!dw) return; QWidget* cw = dw->findChild(QString::fromLatin1("Combo View")); - if (cw == nullptr) + if (!cw) return; QTabWidget* tw = cw->findChild(QString::fromLatin1("combiTab")); - if (tw == nullptr) + if (!tw) return; QStackedWidget* sw = tw->findChild(QString::fromLatin1("qt_tabwidget_stackedwidget")); - if (sw == nullptr) + if (!sw) return; QScrollArea* sa = sw->findChild(); - if (sa== nullptr) + if (!sa) return; QWidget* wd = sa->widget(); // This is the reason why we cannot use findChildByName() right away!!! - if (wd == nullptr) + if (!wd) return; QObject* wiz = findChildByName(wd, QString::fromLatin1("ShaftWizard")); if (wiz) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp index bdb58909c0..53b37d4615 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp @@ -71,7 +71,7 @@ bool ViewProviderFemConstraintBearing::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp index 3fb31ff394..d7e11187a1 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp @@ -71,7 +71,7 @@ bool ViewProviderFemConstraintFixed::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp index 981bd01822..ff9e25831f 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintFluidBoundary.cpp @@ -69,7 +69,7 @@ bool ViewProviderFemConstraintFluidBoundary::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp index 13612d1d19..5892c496ed 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp @@ -70,7 +70,7 @@ bool ViewProviderFemConstraintForce::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp index 7c5f16aa99..000b24fdae 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp @@ -70,7 +70,7 @@ bool ViewProviderFemConstraintGear::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp index ec465114fa..9dfec05039 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp @@ -69,7 +69,7 @@ bool ViewProviderFemConstraintPulley::setEdit(int ModNum) if (dlg && !constrDlg) { // This case will occur in the ShaftWizard application checkForWizard(); - if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) { + if (!wizardWidget || !wizardSubLayout) { // No shaft wizard is running QMessageBox msgBox; msgBox.setText(QObject::tr("A dialog is already open in the task panel"));