[Gui] remove superfluous nullptr checks
This commit is contained in:
@@ -530,7 +530,7 @@ void Application::open(const char* FileName, const char* Module)
|
||||
qApp->processEvents(); // an update is needed otherwise the new view isn't shown
|
||||
}
|
||||
|
||||
if (Module != nullptr) {
|
||||
if (Module) {
|
||||
try {
|
||||
if (File.hasExtension("FCStd")) {
|
||||
bool handled = false;
|
||||
@@ -592,7 +592,7 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch
|
||||
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
|
||||
if (Module != nullptr) {
|
||||
if (Module) {
|
||||
try {
|
||||
// issue module loading
|
||||
Command::doCommand(Command::App, "import %s", Module);
|
||||
@@ -683,7 +683,7 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
|
||||
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
|
||||
if (Module != nullptr) {
|
||||
if (Module) {
|
||||
try {
|
||||
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId(),DocName);
|
||||
|
||||
@@ -115,7 +115,7 @@ BitmapFactoryInst& BitmapFactoryInst::instance(void)
|
||||
|
||||
void BitmapFactoryInst::destruct (void)
|
||||
{
|
||||
if (_pcSingleton != nullptr)
|
||||
if (_pcSingleton)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ protected:
|
||||
Action * action;
|
||||
bool eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (getMainWindow()->findChild<QStatusBar *>() != nullptr && obj == getMainWindow()->statusBar() && ((event->type() == QEvent::Hide) || (event->type() == QEvent::Show))) {
|
||||
if (getMainWindow()->findChild<QStatusBar *>() && obj == getMainWindow()->statusBar() && ((event->type() == QEvent::Hide) || (event->type() == QEvent::Show))) {
|
||||
this->action->setChecked(getMainWindow()->statusBar()->isVisible());
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -263,7 +263,7 @@ ControlSingleton& ControlSingleton::instance(void)
|
||||
|
||||
void ControlSingleton::destruct (void)
|
||||
{
|
||||
if (_pcSingleton != nullptr)
|
||||
if (_pcSingleton)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void DlgPreferencesImp::addPage(const std::string& className, const std::string&
|
||||
_pages.push_back(std::make_pair(group, pages));
|
||||
}
|
||||
|
||||
if (DlgPreferencesImp::_activeDialog != nullptr) {
|
||||
if (DlgPreferencesImp::_activeDialog) {
|
||||
// If the dialog is currently showing, tell it to insert the new page
|
||||
_activeDialog->reloadPages();
|
||||
}
|
||||
|
||||
@@ -831,7 +831,7 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (before != nullptr) {
|
||||
if (before) {
|
||||
QList<QAction*> group = getActionGroup(*it);
|
||||
bars.front()->removeAction(*it);
|
||||
bars.front()->insertAction(before, *it);
|
||||
|
||||
@@ -588,7 +588,7 @@ void ExpressionLineEdit::setDocumentObject(const App::DocumentObject * currentDo
|
||||
completer->setDocumentObject(currentDocObj, checkInList);
|
||||
return;
|
||||
}
|
||||
if (currentDocObj != nullptr) {
|
||||
if (currentDocObj) {
|
||||
completer = new ExpressionCompleter(currentDocObj, this, noProperty, checkInList);
|
||||
completer->setWidget(this);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
@@ -701,7 +701,7 @@ void ExpressionTextEdit::setDocumentObject(const App::DocumentObject * currentDo
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentDocObj != nullptr) {
|
||||
if (currentDocObj) {
|
||||
completer = new ExpressionCompleter(currentDocObj, this);
|
||||
if (!exactMatch)
|
||||
completer->setFilterMode(Qt::MatchContains);
|
||||
|
||||
@@ -156,7 +156,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption,
|
||||
// get the suffix for the filter: use the selected filter if there is one,
|
||||
// otherwise find the first valid suffix in the complete list of filters
|
||||
const QString *filterToSearch;
|
||||
if (selectedFilter != nullptr) {
|
||||
if (selectedFilter) {
|
||||
filterToSearch = selectedFilter;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -643,7 +643,7 @@ void MainWindow::activateWorkbench(const QString& name)
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
bool saveWB = hGrp->GetBool("SaveWBbyTab", false);
|
||||
QMdiSubWindow* subWin = d->mdiArea->activeSubWindow();
|
||||
if (subWin /*!= nullptr*/ && saveWB) {
|
||||
if (subWin && saveWB) {
|
||||
QString currWb = subWin->property("ownWB").toString();
|
||||
if (currWb.isEmpty() || currWb != name) {
|
||||
subWin->setProperty("ownWB", name);
|
||||
|
||||
@@ -553,7 +553,7 @@ void ProgressBar::setupTaskBarProgress()
|
||||
|
||||
bool ProgressBar::eventFilter(QObject* o, QEvent* e)
|
||||
{
|
||||
if (sequencer->isRunning() && e != nullptr) {
|
||||
if (sequencer->isRunning() && e) {
|
||||
QThread* currentThread = QThread::currentThread();
|
||||
QThread* thr = this->thread(); // this is the main thread
|
||||
if (thr != currentThread) {
|
||||
|
||||
@@ -46,7 +46,7 @@ QListWidgetCustom::~QListWidgetCustom()
|
||||
*/
|
||||
void QListWidgetCustom::dragMoveEvent(QDragMoveEvent *e)
|
||||
{
|
||||
if (e->source() != nullptr) {
|
||||
if (e->source()) {
|
||||
QVariant prop = this->property("OnlyAcceptFrom");
|
||||
if (prop.isValid()) {
|
||||
QStringList filter = prop.toStringList();
|
||||
|
||||
@@ -57,7 +57,7 @@ QuarterP::~QuarterP()
|
||||
delete QuarterP::statecursormap;
|
||||
|
||||
// FIXME: Why not use an atexit mechanism for this?
|
||||
if (KeyboardP::keyboardmap != nullptr) {
|
||||
if (KeyboardP::keyboardmap) {
|
||||
KeyboardP::keyboardmap->clear();
|
||||
KeyboardP::keypadmap->clear();
|
||||
delete KeyboardP::keyboardmap;
|
||||
|
||||
@@ -681,7 +681,7 @@ QuarterWidget::setSoRenderManager(SoRenderManager * manager)
|
||||
SoNode * scene = nullptr;
|
||||
SoCamera * camera = nullptr;
|
||||
SbViewportRegion vp;
|
||||
if (PRIVATE(this)->sorendermanager && (manager != nullptr)) {
|
||||
if (PRIVATE(this)->sorendermanager && manager) {
|
||||
scene = PRIVATE(this)->sorendermanager->getSceneGraph();
|
||||
camera = PRIVATE(this)->sorendermanager->getCamera();
|
||||
vp = PRIVATE(this)->sorendermanager->getViewportRegion();
|
||||
@@ -726,7 +726,7 @@ QuarterWidget::setSoEventManager(SoEventManager * manager)
|
||||
SoNode * scene = nullptr;
|
||||
SoCamera * camera = nullptr;
|
||||
SbViewportRegion vp;
|
||||
if (PRIVATE(this)->soeventmanager && (manager != nullptr)) {
|
||||
if (PRIVATE(this)->soeventmanager && manager) {
|
||||
scene = PRIVATE(this)->soeventmanager->getSceneGraph();
|
||||
camera = PRIVATE(this)->soeventmanager->getCamera();
|
||||
vp = PRIVATE(this)->soeventmanager->getViewportRegion();
|
||||
|
||||
@@ -318,10 +318,10 @@ void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::setViewing(SbBool enable)
|
||||
|
||||
// Turn off the selection indicators when we go back from picking
|
||||
// mode into viewing mode.
|
||||
if(m_viewingflag) {
|
||||
if (m_viewingflag) {
|
||||
SoGLRenderAction* action = getSoRenderManager()->getGLRenderAction();
|
||||
|
||||
if(action != nullptr)
|
||||
if (action)
|
||||
SoLocateHighlight::turnOffCurrentHighlight(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1825,7 +1825,7 @@ SelectionSingleton& SelectionSingleton::instance(void)
|
||||
|
||||
void SelectionSingleton::destruct (void)
|
||||
{
|
||||
if (_pcSingleton != nullptr)
|
||||
if (_pcSingleton)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ SbBool TDragger::setUpConnections(SbBool onoff, SbBool doitalways)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->fieldSensor.getAttachedField() != nullptr)
|
||||
if (this->fieldSensor.getAttachedField())
|
||||
this->fieldSensor.detach();
|
||||
inherited::setUpConnections(onoff, doitalways);
|
||||
}
|
||||
@@ -603,7 +603,7 @@ SbBool RDragger::setUpConnections(SbBool onoff, SbBool doitalways)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->fieldSensor.getAttachedField() != nullptr)
|
||||
if (this->fieldSensor.getAttachedField())
|
||||
this->fieldSensor.detach();
|
||||
inherited::setUpConnections(onoff, doitalways);
|
||||
}
|
||||
@@ -857,10 +857,10 @@ SbBool SoFCCSysDragger::setUpConnections(SbBool onoff, SbBool doitalways)
|
||||
|
||||
inherited::setUpConnections(onoff, doitalways);
|
||||
|
||||
if (this->translationSensor.getAttachedField() != nullptr)
|
||||
if (this->translationSensor.getAttachedField())
|
||||
this->translationSensor.detach();
|
||||
|
||||
if (this->rotationSensor.getAttachedField() != nullptr)
|
||||
if (this->rotationSensor.getAttachedField())
|
||||
this->rotationSensor.detach();
|
||||
}
|
||||
return !(this->connectionsSetUp = onoff);
|
||||
|
||||
@@ -117,7 +117,7 @@ SoFCSelection::~SoFCSelection()
|
||||
{
|
||||
// If we're being deleted and we're the current highlight,
|
||||
// NULL out that variable
|
||||
if (currenthighlight != nullptr &&
|
||||
if (currenthighlight &&
|
||||
(!currenthighlight->getTail()->isOfType(SoFCSelection::getClassTypeId()))) {
|
||||
currenthighlight->unref();
|
||||
currenthighlight = nullptr;
|
||||
|
||||
@@ -137,7 +137,7 @@ SoFCUnifiedSelection::~SoFCUnifiedSelection()
|
||||
{
|
||||
// If we're being deleted and we're the current highlight,
|
||||
// NULL out that variable
|
||||
if (currenthighlight != nullptr) {
|
||||
if (currenthighlight) {
|
||||
currenthighlight->unref();
|
||||
currenthighlight = nullptr;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ RotTransDragger::invalidateSurroundScaleCB(void *parent, SoDragger *)
|
||||
// Invalidate the surroundScale, if it exists.
|
||||
SoSurroundScale *mySS = SO_CHECK_PART(
|
||||
myParentDragger, "surroundScale", SoSurroundScale);
|
||||
if (mySS != nullptr)
|
||||
if (mySS)
|
||||
mySS->invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ void ExpressionSpinBox::openFormulaDialog()
|
||||
PropertyQuantity * qprop = freecad_dynamic_cast<PropertyQuantity>(getPath().getProperty());
|
||||
Unit unit;
|
||||
|
||||
if (qprop != nullptr)
|
||||
if (qprop)
|
||||
unit = qprop->getUnit();
|
||||
|
||||
Gui::Dialog::DlgExpressionInput* box = new Gui::Dialog::DlgExpressionInput(getPath(), getExpression(), unit, spinbox);
|
||||
|
||||
@@ -53,14 +53,14 @@ Gui::WidgetFactoryInst* Gui::WidgetFactoryInst::_pcSingleton = nullptr;
|
||||
|
||||
WidgetFactoryInst& WidgetFactoryInst::instance()
|
||||
{
|
||||
if (_pcSingleton == nullptr)
|
||||
if (!_pcSingleton)
|
||||
_pcSingleton = new WidgetFactoryInst;
|
||||
return *_pcSingleton;
|
||||
}
|
||||
|
||||
void WidgetFactoryInst::destruct ()
|
||||
{
|
||||
if (_pcSingleton != nullptr)
|
||||
if (_pcSingleton)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ Gui::WorkbenchFactoryInst* Gui::WorkbenchFactoryInst::_pcSingleton = nullptr;
|
||||
|
||||
WorkbenchFactoryInst& WorkbenchFactoryInst::instance()
|
||||
{
|
||||
if (_pcSingleton == nullptr)
|
||||
if (!_pcSingleton)
|
||||
_pcSingleton = new WorkbenchFactoryInst;
|
||||
return *_pcSingleton;
|
||||
}
|
||||
|
||||
void WorkbenchFactoryInst::destruct ()
|
||||
{
|
||||
if ( _pcSingleton != nullptr )
|
||||
if (_pcSingleton)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user