From 1178df06b41aa3b8fb0943c8046092430ac108ca Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 23 Mar 2022 18:41:21 +0100 Subject: [PATCH] Gui: modernize C++11 * use nullptr --- src/Gui/Action.cpp | 8 +- src/Gui/Action.h | 20 +-- src/Gui/ActionFunction.h | 2 +- src/Gui/ActiveObjectList.h | 8 +- src/Gui/Application.cpp | 66 ++++---- src/Gui/Application.h | 4 +- src/Gui/ApplicationPy.cpp | 4 +- src/Gui/Assistant.cpp | 10 +- src/Gui/AutoSaver.cpp | 2 +- src/Gui/AxisOriginPyImp.cpp | 12 +- src/Gui/BitmapFactory.cpp | 10 +- src/Gui/CallTips.cpp | 2 +- src/Gui/Clipping.cpp | 2 +- src/Gui/ComboView.h | 2 +- src/Gui/Command.cpp | 28 +-- src/Gui/Command.h | 18 +- src/Gui/CommandDoc.cpp | 8 +- src/Gui/CommandLink.cpp | 24 +-- src/Gui/CommandMacro.cpp | 6 +- src/Gui/CommandPyImp.cpp | 2 +- src/Gui/CommandStd.cpp | 2 +- src/Gui/CommandTest.cpp | 16 +- src/Gui/CommandView.cpp | 38 ++--- src/Gui/Control.cpp | 18 +- src/Gui/DAGView/DAGModel.h | 2 +- src/Gui/DAGView/DAGRectItem.h | 4 +- src/Gui/DAGView/DAGView.h | 4 +- src/Gui/DemoMode.h | 2 +- src/Gui/DlgActionsImp.cpp | 2 +- src/Gui/DlgActionsImp.h | 2 +- src/Gui/DlgActivateWindowImp.cpp | 2 +- src/Gui/DlgActivateWindowImp.h | 2 +- src/Gui/DlgCheckableMessageBox.cpp | 2 +- src/Gui/DlgCommandsImp.h | 2 +- src/Gui/DlgCustomizeImp.h | 2 +- src/Gui/DlgCustomizeSpNavSettings.h | 2 +- src/Gui/DlgCustomizeSpaceball.cpp | 10 +- src/Gui/DlgCustomizeSpaceball.h | 8 +- src/Gui/DlgDisplayPropertiesImp.cpp | 4 +- src/Gui/DlgEditFileIncludePropertyExternal.h | 2 +- src/Gui/DlgEditorImp.h | 2 +- src/Gui/DlgExpressionInput.cpp | 4 +- src/Gui/DlgExpressionInput.h | 2 +- src/Gui/DlgGeneralImp.h | 2 +- src/Gui/DlgInputDialogImp.cpp | 2 +- src/Gui/DlgInputDialogImp.h | 2 +- src/Gui/DlgKeyboardImp.h | 2 +- src/Gui/DlgMacroExecuteImp.cpp | 6 +- src/Gui/DlgMacroExecuteImp.h | 2 +- src/Gui/DlgMacroRecordImp.cpp | 2 +- src/Gui/DlgMacroRecordImp.h | 2 +- src/Gui/DlgMaterialPropertiesImp.h | 2 +- src/Gui/DlgObjectSelection.cpp | 8 +- src/Gui/DlgObjectSelection.h | 4 +- src/Gui/DlgOnlineHelpImp.h | 2 +- src/Gui/DlgParameterImp.cpp | 4 +- src/Gui/DlgParameterImp.h | 6 +- src/Gui/DlgPreferencesImp.cpp | 2 +- src/Gui/DlgPreferencesImp.h | 2 +- src/Gui/DlgProjectInformationImp.h | 2 +- src/Gui/DlgProjectUtility.h | 2 +- src/Gui/DlgPropertyLink.cpp | 30 ++-- src/Gui/DlgPropertyLink.h | 4 +- src/Gui/DlgReportViewImp.h | 2 +- src/Gui/DlgRevertToBackupConfigImp.h | 2 +- src/Gui/DlgRunExternal.h | 2 +- src/Gui/DlgSettings3DViewImp.h | 2 +- src/Gui/DlgSettingsColorGradientImp.h | 2 +- src/Gui/DlgSettingsDocumentImp.h | 2 +- src/Gui/DlgSettingsImageImp.h | 2 +- src/Gui/DlgSettingsLazyLoadedImp.h | 2 +- src/Gui/DlgSettingsMacroImp.h | 2 +- src/Gui/DlgSettingsNavigation.h | 2 +- src/Gui/DlgSettingsUnitsImp.h | 2 +- src/Gui/DlgSettingsViewColor.h | 2 +- src/Gui/DlgToolbarsImp.cpp | 4 +- src/Gui/DlgToolbarsImp.h | 6 +- src/Gui/DlgUndoRedo.h | 4 +- src/Gui/DlgUnitsCalculatorImp.h | 2 +- src/Gui/DlgWorkbenchesImp.h | 2 +- src/Gui/DockWindow.h | 2 +- src/Gui/DockWindowManager.cpp | 22 +-- src/Gui/Document.cpp | 82 ++++----- src/Gui/Document.h | 10 +- src/Gui/DocumentModel.cpp | 18 +- src/Gui/DocumentObserver.cpp | 2 +- src/Gui/DocumentObserverPython.cpp | 2 +- src/Gui/DocumentPyImp.cpp | 2 +- src/Gui/DocumentRecovery.h | 2 +- src/Gui/DownloadItem.h | 8 +- src/Gui/DownloadManager.cpp | 10 +- src/Gui/DownloadManager.h | 4 +- src/Gui/EditorView.cpp | 4 +- src/Gui/ExpressionBinding.cpp | 12 +- src/Gui/ExpressionCompleter.cpp | 10 +- src/Gui/ExpressionCompleter.h | 2 +- src/Gui/FileDialog.cpp | 4 +- src/Gui/FileDialog.h | 18 +- src/Gui/Flag.cpp | 8 +- src/Gui/Flag.h | 2 +- src/Gui/GLBuffer.cpp | 10 +- src/Gui/GLPainter.cpp | 10 +- src/Gui/GraphvizView.cpp | 4 +- src/Gui/GraphvizView.h | 2 +- src/Gui/GuiApplication.cpp | 2 +- src/Gui/InputField.h | 2 +- src/Gui/InputVector.h | 14 +- src/Gui/Language/Translator.cpp | 4 +- src/Gui/LinkViewPyImp.cpp | 62 +++---- src/Gui/MDIView.cpp | 6 +- src/Gui/MDIView.h | 6 +- src/Gui/MDIViewPy.cpp | 6 +- src/Gui/Macro.cpp | 8 +- src/Gui/MainWindow.cpp | 40 ++--- src/Gui/MainWindow.h | 6 +- src/Gui/ManualAlignment.cpp | 26 +-- src/Gui/MenuManager.cpp | 10 +- src/Gui/MergeDocuments.cpp | 4 +- src/Gui/MouseSelection.cpp | 4 +- src/Gui/NaviCube.cpp | 10 +- src/Gui/NavigationStyle.cpp | 2 +- src/Gui/NetworkRetriever.h | 4 +- src/Gui/OnlineDocumentation.cpp | 2 +- src/Gui/OnlineDocumentation.h | 2 +- src/Gui/Placement.cpp | 4 +- src/Gui/Placement.h | 4 +- src/Gui/PrefWidgets.h | 24 +-- src/Gui/ProgressBar.cpp | 10 +- src/Gui/ProgressBar.h | 4 +- src/Gui/ProgressDialog.cpp | 2 +- src/Gui/ProgressDialog.h | 2 +- src/Gui/ProjectView.h | 2 +- src/Gui/PropertyPage.cpp | 2 +- src/Gui/PropertyPage.h | 8 +- src/Gui/PropertyView.cpp | 2 +- src/Gui/PropertyView.h | 6 +- src/Gui/PythonConsole.cpp | 24 +-- src/Gui/PythonConsole.h | 2 +- src/Gui/PythonConsolePy.cpp | 8 +- src/Gui/PythonDebugger.cpp | 16 +- src/Gui/PythonEditor.h | 2 +- src/Gui/QListWidgetCustom.cpp | 2 +- src/Gui/QuantitySpinBox.h | 2 +- src/Gui/ReportView.cpp | 4 +- src/Gui/ReportView.h | 4 +- src/Gui/SceneInspector.h | 2 +- src/Gui/Selection.cpp | 70 ++++---- src/Gui/Selection.h | 62 +++---- src/Gui/SelectionFilter.cpp | 16 +- src/Gui/SelectionObject.cpp | 4 +- src/Gui/SelectionObjectPyImp.cpp | 10 +- src/Gui/SelectionView.cpp | 2 +- src/Gui/SelectionView.h | 8 +- src/Gui/SoFCCSysDragger.cpp | 12 +- src/Gui/SoFCInteractiveElement.cpp | 12 +- src/Gui/SoFCOffscreenRenderer.cpp | 12 +- src/Gui/SoFCOffscreenRenderer.h | 2 +- src/Gui/SoFCSelection.cpp | 14 +- src/Gui/SoFCSelectionAction.cpp | 46 ++--- src/Gui/SoFCUnifiedSelection.cpp | 68 ++++---- src/Gui/SoFCUnifiedSelection.h | 2 +- src/Gui/SoFCVectorizeSVGAction.cpp | 2 +- src/Gui/SoFCVectorizeU3DAction.cpp | 2 +- src/Gui/SoNavigationDragger.cpp | 12 +- src/Gui/SoTouchEvents.cpp | 2 +- src/Gui/SpinBox.cpp | 6 +- src/Gui/SpinBox.h | 6 +- src/Gui/Splashscreen.cpp | 6 +- src/Gui/Splashscreen.h | 4 +- src/Gui/SplitView3DInventor.cpp | 22 +-- src/Gui/TaskCSysDragger.cpp | 2 +- src/Gui/TaskDlgRelocation.h | 4 +- src/Gui/TaskElementColors.cpp | 6 +- src/Gui/TaskView/TaskAppearance.h | 2 +- src/Gui/TaskView/TaskDialogPython.cpp | 20 +-- src/Gui/TaskView/TaskEditControl.h | 2 +- src/Gui/TaskView/TaskSelectLinkProperty.cpp | 4 +- src/Gui/TaskView/TaskSelectLinkProperty.h | 2 +- src/Gui/TaskView/TaskView.cpp | 8 +- src/Gui/TaskView/TaskView.h | 18 +- src/Gui/TaskView/TaskWatcher.cpp | 8 +- src/Gui/TextEdit.cpp | 4 +- src/Gui/TextEdit.h | 4 +- src/Gui/TextureMapping.cpp | 4 +- src/Gui/TextureMapping.h | 2 +- src/Gui/Thumbnail.cpp | 2 +- src/Gui/ToolBarManager.cpp | 10 +- src/Gui/ToolBox.h | 2 +- src/Gui/ToolBoxManager.cpp | 6 +- src/Gui/Transform.cpp | 4 +- src/Gui/Transform.h | 2 +- src/Gui/Tree.cpp | 160 +++++++++--------- src/Gui/Tree.h | 18 +- src/Gui/TreeView.cpp | 2 +- src/Gui/TreeView.h | 2 +- src/Gui/VectorListEditor.h | 2 +- src/Gui/View.cpp | 4 +- src/Gui/View.h | 2 +- src/Gui/View3DInventor.cpp | 10 +- src/Gui/View3DInventor.h | 4 +- src/Gui/View3DInventorExamples.cpp | 8 +- src/Gui/View3DInventorViewer.cpp | 70 ++++---- src/Gui/View3DInventorViewer.h | 14 +- src/Gui/View3DPy.cpp | 40 ++--- src/Gui/View3DViewerPy.cpp | 16 +- src/Gui/ViewProvider.cpp | 16 +- src/Gui/ViewProvider.h | 6 +- src/Gui/ViewProviderAnnotation.cpp | 6 +- src/Gui/ViewProviderBuilder.cpp | 2 +- src/Gui/ViewProviderDocumentObject.cpp | 16 +- src/Gui/ViewProviderDocumentObject.h | 6 +- src/Gui/ViewProviderDragger.cpp | 4 +- src/Gui/ViewProviderExtensionPyImp.cpp | 2 +- .../ViewProviderGeoFeatureGroupExtension.cpp | 2 +- src/Gui/ViewProviderGeometryObject.cpp | 6 +- src/Gui/ViewProviderLink.cpp | 86 +++++----- src/Gui/ViewProviderLink.h | 16 +- src/Gui/ViewProviderLinkPyImp.cpp | 2 +- src/Gui/ViewProviderMeasureDistance.cpp | 2 +- src/Gui/ViewProviderOrigin.cpp | 2 +- src/Gui/ViewProviderOriginGroupExtension.cpp | 4 +- src/Gui/ViewProviderPyImp.cpp | 40 ++--- src/Gui/ViewProviderPythonFeature.cpp | 14 +- src/Gui/ViewProviderPythonFeature.h | 6 +- src/Gui/WaitCursor.cpp | 4 +- src/Gui/Widgets.cpp | 12 +- src/Gui/Widgets.h | 26 +-- src/Gui/Workbench.cpp | 10 +- src/Gui/WorkbenchFactory.cpp | 10 +- src/Gui/WorkbenchManager.cpp | 12 +- src/Gui/propertyeditor/PropertyEditor.cpp | 4 +- src/Gui/propertyeditor/PropertyEditor.h | 2 +- src/Gui/propertyeditor/PropertyItem.cpp | 36 ++-- src/Gui/propertyeditor/PropertyItem.h | 2 +- .../propertyeditor/PropertyItemDelegate.cpp | 10 +- src/Gui/propertyeditor/PropertyModel.cpp | 2 +- src/Main/FreeCADGuiPy.cpp | 36 ++-- src/Main/MainGui.cpp | 8 +- src/Main/MainPy.cpp | 4 +- 239 files changed, 1197 insertions(+), 1197 deletions(-) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 7d02e45ecd..1c00159833 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -223,7 +223,7 @@ void Action::setMenuRole(QAction::MenuRole menuRole) * to the command object. */ ActionGroup::ActionGroup ( Command* pcCmd,QObject * parent) - : Action(pcCmd, parent), _group(0), _dropDown(false),_external(false),_toggle(false),_isMode(false) + : Action(pcCmd, parent), _group(nullptr), _dropDown(false),_external(false),_toggle(false),_isMode(false) { _group = new QActionGroup(this); connect(_group, SIGNAL(triggered(QAction*)), this, SLOT(onActivated (QAction*))); @@ -1169,7 +1169,7 @@ void RedoAction::setVisible ( bool b ) // -------------------------------------------------------------------- DockWidgetAction::DockWidgetAction ( Command* pcCmd, QObject * parent ) - : Action(pcCmd, parent), _menu(0) + : Action(pcCmd, parent), _menu(nullptr) { } @@ -1192,7 +1192,7 @@ void DockWidgetAction::addTo ( QWidget * w ) // -------------------------------------------------------------------- ToolBarAction::ToolBarAction ( Command* pcCmd, QObject * parent ) - : Action(pcCmd, parent), _menu(0) + : Action(pcCmd, parent), _menu(nullptr) { } @@ -1215,7 +1215,7 @@ void ToolBarAction::addTo ( QWidget * w ) // -------------------------------------------------------------------- WindowAction::WindowAction ( Command* pcCmd, QObject * parent ) - : ActionGroup(pcCmd, parent), _menu(0) + : ActionGroup(pcCmd, parent), _menu(nullptr) { } diff --git a/src/Gui/Action.h b/src/Gui/Action.h index d50deb8cb0..6a6be0c5a0 100644 --- a/src/Gui/Action.h +++ b/src/Gui/Action.h @@ -45,7 +45,7 @@ class GuiExport Action : public QObject Q_OBJECT public: - Action (Command* pcCmd, QObject * parent = 0); + Action (Command* pcCmd, QObject * parent = nullptr); /// Action takes ownership of the 'action' object. Action (Command* pcCmd, QAction* action, QObject * parent); virtual ~Action(); @@ -98,7 +98,7 @@ class GuiExport ActionGroup : public Action Q_OBJECT public: - ActionGroup (Command* pcCmd, QObject * parent = 0); + ActionGroup (Command* pcCmd, QObject * parent = nullptr); virtual ~ActionGroup(); void addTo (QWidget * w); @@ -138,7 +138,7 @@ class GuiExport WorkbenchComboBox : public QComboBox Q_OBJECT public: - WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=0); + WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=nullptr); virtual ~WorkbenchComboBox(); void showPopup(); @@ -197,7 +197,7 @@ class GuiExport RecentFilesAction : public ActionGroup Q_OBJECT public: - RecentFilesAction (Command* pcCmd, QObject * parent = 0); + RecentFilesAction (Command* pcCmd, QObject * parent = nullptr); virtual ~RecentFilesAction(); void appendFile(const QString&); @@ -230,7 +230,7 @@ class GuiExport RecentMacrosAction : public ActionGroup Q_OBJECT public: - RecentMacrosAction (Command* pcCmd, QObject * parent = 0); + RecentMacrosAction (Command* pcCmd, QObject * parent = nullptr); virtual ~RecentMacrosAction(); void appendFile(const QString&); @@ -263,7 +263,7 @@ class GuiExport UndoAction : public Action Q_OBJECT public: - UndoAction (Command* pcCmd,QObject * parent = 0); + UndoAction (Command* pcCmd,QObject * parent = nullptr); ~UndoAction(); void addTo (QWidget * w); void setEnabled(bool); @@ -288,7 +288,7 @@ class GuiExport RedoAction : public Action Q_OBJECT public: - RedoAction (Command* pcCmd,QObject * parent = 0); + RedoAction (Command* pcCmd,QObject * parent = nullptr); ~RedoAction(); void addTo ( QWidget * w ); void setEnabled(bool); @@ -312,7 +312,7 @@ class GuiExport DockWidgetAction : public Action Q_OBJECT public: - DockWidgetAction (Command* pcCmd, QObject * parent = 0); + DockWidgetAction (Command* pcCmd, QObject * parent = nullptr); virtual ~DockWidgetAction(); void addTo (QWidget * w); @@ -331,7 +331,7 @@ class GuiExport ToolBarAction : public Action Q_OBJECT public: - ToolBarAction (Command* pcCmd, QObject * parent = 0); + ToolBarAction (Command* pcCmd, QObject * parent = nullptr); virtual ~ToolBarAction(); void addTo (QWidget * w); @@ -349,7 +349,7 @@ class GuiExport WindowAction : public ActionGroup Q_OBJECT public: - WindowAction (Command* pcCmd, QObject * parent = 0); + WindowAction (Command* pcCmd, QObject * parent = nullptr); virtual ~WindowAction(); void addTo (QWidget * w); diff --git a/src/Gui/ActionFunction.h b/src/Gui/ActionFunction.h index bbc2cd95ec..29adb0c4eb 100644 --- a/src/Gui/ActionFunction.h +++ b/src/Gui/ActionFunction.h @@ -95,7 +95,7 @@ class GuiExport TimerFunction : public QObject public: /// Constructor - TimerFunction(QObject* = 0); + TimerFunction(QObject* = nullptr); virtual ~TimerFunction(); void setFunction(boost::function func); diff --git a/src/Gui/ActiveObjectList.h b/src/Gui/ActiveObjectList.h index bddcdf3dc6..b7d021a8e2 100644 --- a/src/Gui/ActiveObjectList.h +++ b/src/Gui/ActiveObjectList.h @@ -54,23 +54,23 @@ namespace Gui {} template - inline _T getObject(const char* name, App::DocumentObject **parent=0, std::string *subname=0) const { + inline _T getObject(const char* name, App::DocumentObject **parent=nullptr, std::string *subname=nullptr) const { auto it = _ObjectMap.find(name); if(it==_ObjectMap.end()) return 0; return dynamic_cast<_T>(getObject(it->second,true,parent,subname)); } - void setObject(App::DocumentObject*, const char*, const char *subname=0, + void setObject(App::DocumentObject*, const char*, const char *subname=nullptr, const Gui::HighlightMode& m = HighlightMode::UserDefined); bool hasObject(const char*)const; void objectDeleted(const ViewProviderDocumentObject& viewProviderIn); - bool hasObject(App::DocumentObject *obj, const char *, const char *subname=0) const; + bool hasObject(App::DocumentObject *obj, const char *, const char *subname=nullptr) const; private: struct ObjectInfo; void setHighlight(const ObjectInfo &info, Gui::HighlightMode mode, bool enable); App::DocumentObject *getObject(const ObjectInfo &info, bool resolve, - App::DocumentObject **parent=0, std::string *subname=0) const; + App::DocumentObject **parent=nullptr, std::string *subname=nullptr) const; ObjectInfo getObjectInfo(App::DocumentObject *obj, const char *subname) const; private: diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 9cd4ac9bb4..c5cb6aebd5 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -123,7 +123,7 @@ using namespace std; namespace sp = std::placeholders; -Application* Application::Instance = 0L; +Application* Application::Instance = nullptr; namespace Gui { @@ -160,8 +160,8 @@ public: struct ApplicationP { ApplicationP(bool GUIenabled) : - activeDocument(0L), - editDocument(0L), + activeDocument(nullptr), + editDocument(nullptr), isClosing(false), startingUp(true) { @@ -202,10 +202,10 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args) { PyObject *o; if (!PyArg_ParseTuple(args, "O!",&(App::DocumentObjectPy::Type), &o)) - return NULL; + return nullptr; App::DocumentObject* obj = static_cast(o)->getDocumentObjectPtr(); std::string vp = obj->getViewProviderName(); - SoNode* node = 0; + SoNode* node = nullptr; try { Base::BaseClass* base = static_cast(Base::Type::createInstanceByName(vp.c_str(), true)); if (base && base->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) { @@ -240,7 +240,7 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args) } type += " *"; - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)node, 1); return Py::new_reference_to(Py::Object(proxy, true)); } @@ -248,7 +248,7 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args) catch (const Base::Exception& e) { if (node) node->unref(); PyErr_SetString(PyExc_RuntimeError, e.what()); - return 0; + return nullptr; } Py_INCREF(Py_None); @@ -264,7 +264,7 @@ FreeCADGui_exportSubgraph(PyObject * /*self*/, PyObject *args) if (!PyArg_ParseTuple(args, "OO|s", &proxy, &output, &format)) return nullptr; - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", proxy, &ptr, 0); SoNode* node = reinterpret_cast(ptr); @@ -283,7 +283,7 @@ FreeCADGui_exportSubgraph(PyObject * /*self*/, PyObject *args) } Base::PyStreambuf buf(output); - std::ostream str(0); + std::ostream str(nullptr); str.rdbuf(&buf); str << buffer; } @@ -301,7 +301,7 @@ static PyObject * FreeCADGui_getSoDBVersion(PyObject * /*self*/, PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; return PyUnicode_FromString(SoDB::getVersion()); } @@ -317,7 +317,7 @@ struct PyMethodDef FreeCADGui_methods[] = { "getSoDBVersion() -> String\n\n" "Return a text string containing the name\n" "of the Coin library and version information"}, - {NULL, NULL, 0, NULL} /* sentinel */ + {nullptr, nullptr, 0, nullptr} /* sentinel */ }; } // namespace Gui @@ -391,7 +391,7 @@ Application::Application(bool GUIenabled) PyModuleDef_HEAD_INIT, "FreeCADGui", FreeCADGui_doc, -1, Application::Methods, - NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr }; module = PyModule_Create(&FreeCADGuiModuleDef); @@ -420,7 +420,7 @@ Application::Application(bool GUIenabled) PyModuleDef_HEAD_INIT, "Selection", "Selection module", -1, SelectionSingleton::Methods, - NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr }; PyObject* pSelectionModule = PyModule_Create(&SelectionModuleDef); Py_INCREF(pSelectionModule); @@ -447,10 +447,10 @@ Application::Application(bool GUIenabled) PyObject *module = PyImport_AddModule("FreeCADGui"); PyMethodDef *meth = FreeCADGui_methods; PyObject *dict = PyModule_GetDict(module); - for (; meth->ml_name != NULL; meth++) { + for (; meth->ml_name != nullptr; meth++) { PyObject *descr; - descr = PyCFunction_NewEx(meth,0,0); - if (descr == NULL) + descr = PyCFunction_NewEx(meth,nullptr,nullptr); + if (descr == nullptr) break; if (PyDict_SetItemString(dict, meth->ml_name, descr) != 0) break; @@ -525,7 +525,7 @@ Application::~Application() //App::GetApplication().Detach(this); delete d; - Instance = 0; + Instance = nullptr; } @@ -551,7 +551,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 != 0) { + if (Module != nullptr) { try { if (File.hasExtension("FCStd")) { bool handled = false; @@ -613,7 +613,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 != 0) { + if (Module != nullptr) { try { // issue module loading Command::doCommand(Command::App, "import %s", Module); @@ -704,7 +704,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 != 0) { + if (Module != nullptr) { try { std::vector sel = Gui::Selection().getObjectsOfType (App::DocumentObject::getClassTypeId(),DocName); @@ -820,7 +820,7 @@ void Application::slotDeleteDocument(const App::Document& Doc) // If the active document gets destructed we must set it to 0. If there are further existing documents then the // view that becomes active sets the active document again. So, we needn't worry about this. if (d->activeDocument == doc->second) - setActiveDocument(0); + setActiveDocument(nullptr); d->viewproviderMap.deleteDocument(Doc); @@ -1022,7 +1022,7 @@ Gui::MDIView* Application::activeView(void) const if (activeDocument()) return activeDocument()->getActiveView(); else - return NULL; + return nullptr; } /** @@ -1061,14 +1061,14 @@ Gui::Document* Application::editDocument(void) const Gui::MDIView* Application::editViewOfNode(SoNode *node) const { - return d->editDocument?d->editDocument->getViewOfNode(node):0; + return d->editDocument?d->editDocument->getViewOfNode(node):nullptr; } void Application::setEditDocument(Gui::Document *doc) { if(doc == d->editDocument) return; if(!doc) - d->editDocument = 0; + d->editDocument = nullptr; for(auto &v : d->documents) v.second->_resetEdit(); d->editDocument = doc; @@ -1149,7 +1149,7 @@ Gui::Document* Application::getDocument(const char* name) const if ( it!=d->documents.end() ) return it->second; else - return 0; + return nullptr; } Gui::Document* Application::getDocument(const App::Document* pDoc) const @@ -1158,7 +1158,7 @@ Gui::Document* Application::getDocument(const App::Document* pDoc) const if ( it!=d->documents.end() ) return it->second; else - return 0; + return nullptr; } void Application::showViewProvider(const App::DocumentObject* obj) @@ -1322,13 +1322,13 @@ bool Application::activateWorkbench(const char* name) Base::PyGILStateLocker lock; // we check for the currently active workbench and call its 'Deactivated' // method, if available - PyObject* pcOldWorkbench = 0; + PyObject* pcOldWorkbench = nullptr; if (oldWb) { pcOldWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, oldWb->name().c_str()); } // get the python workbench object from the dictionary - PyObject* pcWorkbench = 0; + PyObject* pcWorkbench = nullptr; pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, name); // test if the workbench exists if (!pcWorkbench) @@ -1635,7 +1635,7 @@ void Application::setupContextMenu(const char* recipient, MenuItem* items) const if (actWb->getTypeId().isDerivedFrom(PythonWorkbench::getClassTypeId())) { static_cast(actWb)->clearContextMenu(); Base::PyGILStateLocker lock; - PyObject* pWorkbench = 0; + PyObject* pWorkbench = nullptr; pWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, actWb->name().c_str()); try { @@ -1684,7 +1684,7 @@ Gui::PreferencePackManager* Application::prefPackManager(void) // Init, Destruct and singleton typedef void (*_qt_msg_handler_old)(QtMsgType, const QMessageLogContext &, const QString &); -_qt_msg_handler_old old_qtmsg_handler = 0; +_qt_msg_handler_old old_qtmsg_handler = nullptr; void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { @@ -2436,7 +2436,7 @@ void Application::checkForPreviousCrashes() } App::Document *Application::reopen(App::Document *doc) { - if(!doc) return 0; + if(!doc) return nullptr; std::string name = doc->FileName.getValue(); std::set untouchedDocs; for(auto &v : d->documents) { @@ -2464,7 +2464,7 @@ App::Document *Application::reopen(App::Document *doc) { if(gdoc) { setActiveDocument(gdoc); if(!gdoc->setActiveView()) - gdoc->setActiveView(0,View3DInventor::getClassTypeId()); + gdoc->setActiveView(nullptr,View3DInventor::getClassTypeId()); } return doc; } @@ -2473,7 +2473,7 @@ App::Document *Application::reopen(App::Document *doc) { App::GetApplication().openDocument(file.c_str(),false); } - doc = 0; + doc = nullptr; for(auto &v : d->documents) { if(name == v.first->FileName.getValue()) doc = const_cast(v.first); diff --git a/src/Gui/Application.h b/src/Gui/Application.h index 2e8089d665..6a740791a1 100644 --- a/src/Gui/Application.h +++ b/src/Gui/Application.h @@ -75,11 +75,11 @@ public: /** @name methods for View handling */ //@{ /// send Messages to the active view - bool sendMsgToActiveView(const char* pMsg, const char** ppReturn=0); + bool sendMsgToActiveView(const char* pMsg, const char** ppReturn=nullptr); /// send Messages test to the active view bool sendHasMsgToActiveView(const char* pMsg); /// send Messages to the focused view - bool sendMsgToFocusView(const char* pMsg, const char** ppReturn=0); + bool sendMsgToFocusView(const char* pMsg, const char** ppReturn=nullptr); /// send Messages test to the focused view bool sendHasMsgToFocusView(const char* pMsg); /// Attach a view (get called by the FCView constructor) diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index f815fa8399..8d9c7ee88a 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -1495,14 +1495,14 @@ PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args) return nullptr; } else if (num_of_views == 1) { - View3DInventor* viewer = new View3DInventor(0, 0); + View3DInventor* viewer = new View3DInventor(nullptr, nullptr); if (title) viewer->setWindowTitle(QString::fromUtf8(title)); Gui::getMainWindow()->addWindow(viewer); return viewer->getPyObject(); } else { - SplitView3DInventor* viewer = new SplitView3DInventor(num_of_views, 0, 0); + SplitView3DInventor* viewer = new SplitView3DInventor(num_of_views, nullptr, nullptr); if (title) viewer->setWindowTitle(QString::fromUtf8(title)); Gui::getMainWindow()->addWindow(viewer); diff --git a/src/Gui/Assistant.cpp b/src/Gui/Assistant.cpp index e55202f0fc..4261768a1b 100644 --- a/src/Gui/Assistant.cpp +++ b/src/Gui/Assistant.cpp @@ -42,7 +42,7 @@ using namespace Gui; /* TRANSLATOR Gui::Assistant */ Assistant::Assistant() - : proc(0) + : proc(nullptr) { } @@ -95,7 +95,7 @@ bool Assistant::startAssistant() QFileInfo fi(qhc); if (!fi.isReadable()) { - QMessageBox::critical(0, tr("%1 Help").arg(exe), + QMessageBox::critical(nullptr, tr("%1 Help").arg(exe), tr("%1 help files not found (%2). You might need to install the %1 documentation package.").arg(exe, qhc)); return false; } @@ -127,7 +127,7 @@ bool Assistant::startAssistant() proc->start(app, args); if (!proc->waitForFinished(50000)) { - QMessageBox::critical(0, tr("%1 Help").arg(exe), + QMessageBox::critical(nullptr, tr("%1 Help").arg(exe), tr("Unable to launch Qt Assistant (%1)").arg(app)); return false; } @@ -141,7 +141,7 @@ bool Assistant::startAssistant() proc->start(app, args); if (!proc->waitForFinished(50000)) { - QMessageBox::critical(0, tr("%1 Help").arg(exe), + QMessageBox::critical(nullptr, tr("%1 Help").arg(exe), tr("Unable to launch Qt Assistant (%1)").arg(app)); return false; } @@ -159,7 +159,7 @@ bool Assistant::startAssistant() proc->start(app, args); if (!proc->waitForStarted()) { - QMessageBox::critical(0, tr("%1 Help").arg(exe), + QMessageBox::critical(nullptr, tr("%1 Help").arg(exe), tr("Unable to launch Qt Assistant (%1)").arg(app)); return false; } diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index 0ce8eb2bb5..6f3d7336da 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -52,7 +52,7 @@ FC_LOG_LEVEL_INIT("App",true,true) using namespace Gui; namespace bp = boost::placeholders; -AutoSaver* AutoSaver::self = 0; +AutoSaver* AutoSaver::self = nullptr; AutoSaver::AutoSaver(QObject* parent) : QObject(parent), timeout(900000), compressed(true) diff --git a/src/Gui/AxisOriginPyImp.cpp b/src/Gui/AxisOriginPyImp.cpp index a84d105197..930f38fd92 100644 --- a/src/Gui/AxisOriginPyImp.cpp +++ b/src/Gui/AxisOriginPyImp.cpp @@ -54,8 +54,8 @@ PyObject* AxisOriginPy::getElementPicked(PyObject* args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O",&obj)) - return NULL; - void *ptr = 0; + return nullptr; + void *ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPickedPoint", obj, &ptr, 0); SoPickedPoint *pp = reinterpret_cast(ptr); if(!pp) @@ -71,13 +71,13 @@ PyObject* AxisOriginPy::getDetailPath(PyObject* args) const char *sub; PyObject *path; if (!PyArg_ParseTuple(args, "sO",&sub,&path)) - return NULL; - void *ptr = 0; + return nullptr; + void *ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPath", path, &ptr, 0); SoPath *pPath = reinterpret_cast(ptr); if(!pPath) throw Base::TypeError("type must be of coin.SoPath"); - SoDetail *det = 0; + SoDetail *det = nullptr; if(!getAxisOriginPtr()->getDetailPath( sub,static_cast(pPath),det)) { @@ -162,7 +162,7 @@ Py::Object AxisOriginPy::getNode(void) const PyObject *AxisOriginPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int AxisOriginPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index d09329b4de..ff3e9a0840 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -86,11 +86,11 @@ public: }; } -BitmapFactoryInst* BitmapFactoryInst::_pcSingleton = NULL; +BitmapFactoryInst* BitmapFactoryInst::_pcSingleton = nullptr; BitmapFactoryInst& BitmapFactoryInst::instance(void) { - if (_pcSingleton == NULL) + if (_pcSingleton == nullptr) { _pcSingleton = new BitmapFactoryInst; std::map::const_iterator it; @@ -114,9 +114,9 @@ BitmapFactoryInst& BitmapFactoryInst::instance(void) void BitmapFactoryInst::destruct (void) { - if (_pcSingleton != 0) + if (_pcSingleton != nullptr) delete _pcSingleton; - _pcSingleton = 0; + _pcSingleton = nullptr; } BitmapFactoryInst::BitmapFactoryInst() @@ -555,7 +555,7 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const } // allocate image data - img.setValue(size, numcomponents, NULL); + img.setValue(size, numcomponents, nullptr); unsigned char * bytes = img.startEditing(size, numcomponents); diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index c0f802fe20..8e97cdf9c1 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -234,7 +234,7 @@ QMap CallTipsList::extractTips(const QString& context) const return tips; } - PyObject* eval = 0; + PyObject* eval = nullptr; if (PyCode_Check(code)) { eval = PyEval_EvalCode(code, dict.ptr(), dict.ptr()); } diff --git a/src/Gui/Clipping.cpp b/src/Gui/Clipping.cpp index d163cbb47f..7c6c18aed5 100644 --- a/src/Gui/Clipping.cpp +++ b/src/Gui/Clipping.cpp @@ -74,7 +74,7 @@ public: clipView->plane.setValue(SbPlane(SbVec3f(0,0,1),0)); clipView->ref(); - node = 0; + node = nullptr; sensor = new SoTimerSensor(moveCallback, this); } ~Private() diff --git a/src/Gui/ComboView.h b/src/Gui/ComboView.h index af70af768c..408d199368 100644 --- a/src/Gui/ComboView.h +++ b/src/Gui/ComboView.h @@ -68,7 +68,7 @@ public: * A constructor. * A more elaborate description of the constructor. */ - ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent=0); + ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent=nullptr); /** * A destructor. diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 8aa9f990b3..da8be223ed 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -170,7 +170,7 @@ Action* CommandBase::getAction() const Action * CommandBase::createAction() { // does nothing - return 0; + return nullptr; } void CommandBase::setMenuText(const char* s) @@ -212,7 +212,7 @@ void CommandBase::setAccel(const char* s) Command::Command(const char* name) : CommandBase(nullptr) , sName(name) - , sHelpUrl(0) + , sHelpUrl(nullptr) { sAppModule = "FreeCAD"; sGroup = "Standard"; @@ -282,7 +282,7 @@ App::Document* Command::getDocument(const char* Name) const if (pcDoc) return pcDoc->getDocument(); else - return 0l; + return nullptr; } } @@ -292,7 +292,7 @@ App::DocumentObject* Command::getObject(const char* Name) const if (pDoc) return pDoc->getObject(Name); else - return 0; + return nullptr; } int Command::_busy; @@ -306,7 +306,7 @@ public: cancel(); } void cancel() { - Application::Instance->macroManager()->addLine(MacroManager::Cmt,0,true); + Application::Instance->macroManager()->addLine(MacroManager::Cmt,nullptr,true); } }; @@ -327,7 +327,7 @@ private: }; void Command::setupCheckable(int iMsg) { - QAction *action = 0; + QAction *action = nullptr; Gui::ActionGroup* pcActionGroup = qobject_cast(_pcAction); if(pcActionGroup) { QList a = pcActionGroup->actions(); @@ -523,12 +523,12 @@ void Command::setEnabled(bool on) bool Command::hasActiveDocument(void) const { - return getActiveGuiDocument() != 0; + return getActiveGuiDocument() != nullptr; } /// true when there is a document and a Feature with Name bool Command::hasObject(const char* Name) { - return getDocument() != 0 && getDocument()->getObject(Name) != 0; + return getDocument() != nullptr && getDocument()->getObject(Name) != nullptr; } Gui::SelectionSingleton& Command::getSelection(void) @@ -766,7 +766,7 @@ void Command::_copyVisual(const char *file, int line, const App::DocumentObject objCmd.c_str(),attr_to,getObjectCmd(obj).c_str(),it->second.c_str()); return; } - auto linked = obj->getLinkedObject(false,0,false,depth); + auto linked = obj->getLinkedObject(false,nullptr,false,depth); if(!linked || linked==obj) break; obj = linked; @@ -1187,7 +1187,7 @@ void MacroCommand::load() macro->setStatusTip ( (*it)->GetASCII( "Statustip" ).c_str() ); if ((*it)->GetASCII("Pixmap", "nix") != "nix") macro->setPixmap ( (*it)->GetASCII( "Pixmap" ).c_str() ); - macro->setAccel ( (*it)->GetASCII( "Accel",0 ).c_str() ); + macro->setAccel ( (*it)->GetASCII( "Accel",nullptr ).c_str() ); macro->systemMacro = (*it)->GetBool("System", false); Application::Instance->commandManager().addCommand( macro ); } @@ -1284,7 +1284,7 @@ void PythonCommand::activated(int iMsg) if (Activation.empty()) { try { if (isCheckable()) { - Interpreter().runMethod(_pcPyCommand, "Activated", "", 0, "(i)", iMsg); + Interpreter().runMethod(_pcPyCommand, "Activated", "", nullptr, "(i)", iMsg); } else { Interpreter().runMethodVoid(_pcPyCommand, "Activated"); @@ -1346,7 +1346,7 @@ const char* PythonCommand::getHelpUrl(void) const Action * PythonCommand::createAction(void) { - QAction* qtAction = new QAction(0); + QAction* qtAction = new QAction(nullptr); Action *pcAction; pcAction = new Action(this, qtAction, getMainWindow()); @@ -1400,7 +1400,7 @@ const char* PythonCommand::getStatusTip() const const char* PythonCommand::getPixmap() const { const char* ret = getResource("Pixmap"); - return (ret && ret[0] != '\0') ? ret : 0; + return (ret && ret[0] != '\0') ? ret : nullptr; } const char* PythonCommand::getAccel() const @@ -1700,7 +1700,7 @@ const char* PythonGroupCommand::getStatusTip() const const char* PythonGroupCommand::getPixmap() const { const char* ret = getResource("Pixmap"); - return (ret && ret[0] != '\0') ? ret : 0; + return (ret && ret[0] != '\0') ? ret : nullptr; } const char* PythonGroupCommand::getAccel() const diff --git a/src/Gui/Command.h b/src/Gui/Command.h index c30473735e..4436ebacfb 100644 --- a/src/Gui/Command.h +++ b/src/Gui/Command.h @@ -232,8 +232,8 @@ void CreateLinkCommands(void); class GuiExport CommandBase { protected: - CommandBase(const char* sMenu, const char* sToolTip=0, const char* sWhat=0, - const char* sStatus=0, const char* sPixmap=0, const char* sAccel=0); + CommandBase(const char* sMenu, const char* sToolTip=nullptr, const char* sWhat=nullptr, + const char* sStatus=nullptr, const char* sPixmap=nullptr, const char* sAccel=nullptr); virtual ~CommandBase(); public: @@ -382,30 +382,30 @@ public: * document when no name is given. NULL is returned * when the name does not exist or no document is active! */ - App::Document* getDocument(const char* Name=0) const; + App::Document* getDocument(const char* Name=nullptr) const; /// checks if the active view is of a special type or derived bool isViewOfType(Base::Type t) const; /// returns the named feature or the active one from the active document or NULL App::DocumentObject* getObject(const char* Name) const; /// returns a python command string to retrieve an object from a document - static std::string getObjectCmd(const char *Name, const App::Document *doc=0, - const char *prefix=0, const char *postfix=0, bool gui=false); + static std::string getObjectCmd(const char *Name, const App::Document *doc=nullptr, + const char *prefix=nullptr, const char *postfix=nullptr, bool gui=false); /// returns a python command string to retrieve the given object static std::string getObjectCmd(const App::DocumentObject *obj, - const char *prefix=0, const char *postfix=0, bool gui=false); + const char *prefix=nullptr, const char *postfix=nullptr, bool gui=false); /** Get unique Feature name from the active document * * @param BaseName: the base name * @param obj: if not zero, then request the unique name in the document of * the given object. */ - std::string getUniqueObjectName(const char *BaseName, const App::DocumentObject *obj=0) const; + std::string getUniqueObjectName(const char *BaseName, const App::DocumentObject *obj=nullptr) const; //@} /** @name Helper methods for the Undo/Redo and Update handling */ //@{ /// Open a new Undo transaction on the active document - static void openCommand(const char* sName=0); + static void openCommand(const char* sName=nullptr); /// Commit the Undo transaction on the active document static void commitCommand(void); /// Abort the Undo transaction on the active document @@ -634,7 +634,7 @@ public: * @param reg: whether to register the command with CommandManager * @return Return the command index. */ - int addCommand(Command *cmd = 0, bool reg=true); + int addCommand(Command *cmd = nullptr, bool reg=true); /** Add child command * @param cmd: child command name. * @return Return the found command, or NULL if not found. diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 0f5ebccfc9..3df3e6ed0d 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1276,7 +1276,7 @@ void StdCmdSelectAll::activated(int iMsg) bool StdCmdSelectAll::isActive(void) { - return App::GetApplication().getActiveDocument() != 0; + return App::GetApplication().getActiveDocument() != nullptr; } //=========================================================================== @@ -1313,7 +1313,7 @@ void StdCmdDelete::activated(int iMsg) Gui::getMainWindow()->setUpdatesEnabled(false); auto editDoc = Application::Instance->editDocument(); - ViewProviderDocumentObject *vpedit = 0; + ViewProviderDocumentObject *vpedit = nullptr; if(editDoc) vpedit = dynamic_cast(editDoc->getInEdit()); if(vpedit) { @@ -1529,7 +1529,7 @@ void StdCmdTransform::activated(int iMsg) bool StdCmdTransform::isActive(void) { - return (Gui::Control().activeDialog()==0); + return (Gui::Control().activeDialog()==nullptr); } //=========================================================================== @@ -1707,7 +1707,7 @@ void StdCmdEdit::activated(int iMsg) bool StdCmdEdit::isActive(void) { - return (Selection().getCompleteSelection().size() > 0) || (Gui::Control().activeDialog() != 0); + return (Selection().getCompleteSelection().size() > 0) || (Gui::Control().activeDialog() != nullptr); } //====================================================================== diff --git a/src/Gui/CommandLink.cpp b/src/Gui/CommandLink.cpp index cd961b6377..43b7bbe676 100644 --- a/src/Gui/CommandLink.cpp +++ b/src/Gui/CommandLink.cpp @@ -277,7 +277,7 @@ StdCmdLinkMakeRelative::StdCmdLinkMakeRelative() } bool StdCmdLinkMakeRelative::isActive() { - return Selection().hasSubSelection(0,true); + return Selection().hasSubSelection(nullptr,true); } void StdCmdLinkMakeRelative::activated(int) { @@ -650,22 +650,22 @@ StdCmdLinkSelectLinked::StdCmdLinkSelectLinked() sAccel = "S, G"; } -static App::DocumentObject *getSelectedLink(bool finalLink, std::string *subname=0) { +static App::DocumentObject *getSelectedLink(bool finalLink, std::string *subname=nullptr) { const auto &sels = Selection().getSelection("*",0,true); if(sels.empty()) - return 0; + return nullptr; auto sobj = sels[0].pObject->getSubObject(sels[0].SubName); if(!sobj) - return 0; + return nullptr; auto vp = Base::freecad_dynamic_cast( Application::Instance->getViewProvider(sobj)); if(!vp) - return 0; + return nullptr; auto linkedVp = vp->getLinkedViewProvider(subname,finalLink); if(!linkedVp || linkedVp==vp) { if(sobj->getDocument()==sels[0].pObject->getDocument()) - return 0; + return nullptr; for(const char *dot=strchr(sels[0].SubName,'.');dot;dot=strchr(dot+1,'.')) { std::string sub(sels[0].SubName,dot+1-sels[0].SubName); auto obj = sels[0].pObject->getSubObject(sub.c_str()); @@ -674,21 +674,21 @@ static App::DocumentObject *getSelectedLink(bool finalLink, std::string *subname obj = obj->getLinkedObject(true); if(obj->getDocument()!=sels[0].pObject->getDocument()) { if(finalLink) - return sobj==obj?0:sobj; + return sobj==obj?nullptr:sobj; if(subname) *subname = std::string(dot+1); return obj; } } - return finalLink?0:sobj; + return finalLink?nullptr:sobj; } if(finalLink && linkedVp == vp->getLinkedViewProvider()) - return 0; + return nullptr; auto linked = linkedVp->getObject(); if(!linked || !linked->getNameInDocument()) - return 0; + return nullptr; if(subname && sels[0].pObject!=sobj && sels[0].SubName) { bool found = false; @@ -733,7 +733,7 @@ static App::DocumentObject *getSelectedLink(bool finalLink, std::string *subname } bool StdCmdLinkSelectLinked::isActive() { - return getSelectedLink(false)!=0; + return getSelectedLink(false)!=nullptr; } void StdCmdLinkSelectLinked::activated(int) @@ -778,7 +778,7 @@ StdCmdLinkSelectLinkedFinal::StdCmdLinkSelectLinkedFinal() } bool StdCmdLinkSelectLinkedFinal::isActive() { - return getSelectedLink(true)!=0; + return getSelectedLink(true)!=nullptr; } void StdCmdLinkSelectLinkedFinal::activated(int) { diff --git a/src/Gui/CommandMacro.cpp b/src/Gui/CommandMacro.cpp index b2e7bc95dd..8f15186f3d 100644 --- a/src/Gui/CommandMacro.cpp +++ b/src/Gui/CommandMacro.cpp @@ -241,7 +241,7 @@ StdCmdMacroStepOver::StdCmdMacroStepOver() sToolTipText = QT_TR_NOOP("Step over"); sWhatsThis = "Std_MacroStepOver"; sStatusTip = QT_TR_NOOP("Step over"); - sPixmap = 0; + sPixmap = nullptr; sAccel = "F10"; eType = 0; } @@ -268,7 +268,7 @@ StdCmdMacroStepInto::StdCmdMacroStepInto() sToolTipText = QT_TR_NOOP("Step into"); //sWhatsThis = "Std_MacroStepOver"; sStatusTip = QT_TR_NOOP("Step into"); - sPixmap = 0; + sPixmap = nullptr; sAccel = "F11"; eType = 0; } @@ -295,7 +295,7 @@ StdCmdToggleBreakpoint::StdCmdToggleBreakpoint() sToolTipText = QT_TR_NOOP("Toggle breakpoint"); sWhatsThis = "Std_ToggleBreakpoint"; sStatusTip = QT_TR_NOOP("Toggle breakpoint"); - sPixmap = 0; + sPixmap = nullptr; sAccel = "F9"; eType = 0; } diff --git a/src/Gui/CommandPyImp.cpp b/src/Gui/CommandPyImp.cpp index 3f19bc426c..527c5a8638 100644 --- a/src/Gui/CommandPyImp.cpp +++ b/src/Gui/CommandPyImp.cpp @@ -411,7 +411,7 @@ PyObject* CommandPy::findCustomCommand(PyObject* args) PyObject *CommandPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int CommandPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 87ba6cfbf7..45b82253cd 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -391,7 +391,7 @@ StdCmdDlgCustomize::StdCmdDlgCustomize() void StdCmdDlgCustomize::activated(int iMsg) { Q_UNUSED(iMsg); - static QPointer dlg = 0; + static QPointer dlg = nullptr; if (!dlg) dlg = new Gui::Dialog::DlgCustomizeImp(getMainWindow()); dlg->setAttribute(Qt::WA_DeleteOnClose); diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index 22d584eedd..74a46bf651 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -162,7 +162,7 @@ void FCCmdTest2::activated(int iMsg) bool FCCmdTest2::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } //=========================================================================== @@ -191,7 +191,7 @@ void FCCmdTest3::activated(int iMsg) bool FCCmdTest3::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } //=========================================================================== @@ -221,7 +221,7 @@ void FCCmdTest4::activated(int iMsg) bool FCCmdTest4::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } //=========================================================================== @@ -249,7 +249,7 @@ void FCCmdTest5::activated(int iMsg) bool FCCmdTest5::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } @@ -278,7 +278,7 @@ void FCCmdTest6::activated(int iMsg) bool FCCmdTest6::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } //=========================================================================== @@ -327,7 +327,7 @@ void CmdTestCmdFuncs::activated(int iMsg) bool CmdTestCmdFuncs::isActive(void) { - return (getDocument()!=NULL); + return (getDocument()!=nullptr); } //=========================================================================== @@ -517,7 +517,7 @@ void CmdTestProgress4::activated(int iMsg) QWaitCondition().wait(&mutex, 5); if (i == 45) { delete seq; - seq = 0; + seq = nullptr; } if (seq) { seq->next(false); @@ -692,7 +692,7 @@ void CmdTestMDI3::activated(int iMsg) Q_UNUSED(iMsg); MDIView* mdi = getMainWindow()->activeWindow(); getMainWindow()->removeWindow(mdi); - mdi->setParent(0, Qt::Window | Qt::WindowTitleHint | + mdi->setParent(nullptr, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); mdi->show(); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index e4cbb2d93f..fd33ea0749 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -284,10 +284,10 @@ StdCmdFreezeViews::StdCmdFreezeViews() , maxViews(50) , savedViews(0) , offset(0) - , saveView(0) - , freezeView(0) - , clearView(0) - , separator(0) + , saveView(nullptr) + , freezeView(nullptr) + , clearView(nullptr) + , separator(nullptr) { sGroup = "Standard-View"; sMenuText = QT_TR_NOOP("Freeze display"); @@ -338,7 +338,7 @@ void StdCmdFreezeViews::activated(int iMsg) } else if (iMsg == 3) { // Create a new view - const char* ppReturn=0; + const char* ppReturn=nullptr; getGuiApplication()->sendMsgToActiveView("GetCamera",&ppReturn); QList acts = pcAction->actions(); @@ -1708,12 +1708,12 @@ void StdViewDockUndockFullscreen::activated(int iMsg) if (!clone) return; - const char* ppReturn = 0; + const char* ppReturn = nullptr; if (view->onMsg("GetCamera", &ppReturn)) { std::string sMsg = "SetCamera "; sMsg += ppReturn; - const char** pReturnIgnore=0; + const char** pReturnIgnore=nullptr; clone->onMsg(sMsg.c_str(), pReturnIgnore); } @@ -1987,7 +1987,7 @@ void StdCmdViewCreate::activated(int iMsg) bool StdCmdViewCreate::isActive(void) { - return (getActiveGuiDocument()!=NULL); + return (getActiveGuiDocument()!=nullptr); } //=========================================================================== @@ -2424,7 +2424,7 @@ void StdCmdViewIvIssueCamPos::activated(int iMsg) std::string Temp,Temp2; std::string::size_type pos; - const char* ppReturn=0; + const char* ppReturn=nullptr; getGuiApplication()->sendMsgToActiveView("GetCamera",&ppReturn); // remove the #inventor line... @@ -2757,7 +2757,7 @@ static std::vector getBoxSelection( // DO NOT check this view object Visibility, let the caller do this. Because // we may be called by upper object hierarchy that manages our visibility. - auto bbox3 = vp->getBoundingBox(0,transform); + auto bbox3 = vp->getBoundingBox(nullptr,transform); if(!bbox3.IsValid()) return ret; @@ -2783,9 +2783,9 @@ static std::vector getBoxSelection( return ret; } Base::PyGILStateLocker lock; - PyObject *pyobj = 0; + PyObject *pyobj = nullptr; Base::Matrix4D matCopy(mat); - obj->getSubObject(0,&pyobj,&matCopy,transform,depth); + obj->getSubObject(nullptr,&pyobj,&matCopy,transform,depth); if(!pyobj) return ret; Py::Object pyobject(pyobj,true); @@ -2837,10 +2837,10 @@ static std::vector getBoxSelection( size_t count = 0; for(auto &sub : subs) { - App::DocumentObject *parent = 0; + App::DocumentObject *parent = nullptr; std::string childName; Base::Matrix4D smat(mat); - auto sobj = obj->resolve(sub.c_str(),&parent,&childName,0,0,&smat,transform,depth+1); + auto sobj = obj->resolve(sub.c_str(),&parent,&childName,nullptr,nullptr,&smat,transform,depth+1); if(!sobj) continue; int vis; @@ -2938,7 +2938,7 @@ void StdBoxSelection::activated(int iMsg) SoKeyboardEvent ev; viewer->navigationStyle()->processEvent(&ev); } - SelectionCallbackHandler::Create(viewer, View3DInventorViewer::Rubberband, QCursor(QPixmap(cursor_box_select), 7, 7), doSelect, NULL); + SelectionCallbackHandler::Create(viewer, View3DInventorViewer::Rubberband, QCursor(QPixmap(cursor_box_select), 7, 7), doSelect, nullptr); SoNode* root = viewer->getSceneGraph(); static_cast(root)->selectionRole.setValue(false); } @@ -3129,7 +3129,7 @@ bool StdCmdTreeSelectAllInstances::isActive(void) if(!obj || !obj->getNameInDocument()) return false; return dynamic_cast( - Application::Instance->getViewProvider(obj))!=0; + Application::Instance->getViewProvider(obj))!=nullptr; } void StdCmdTreeSelectAllInstances::activated(int iMsg) @@ -3266,7 +3266,7 @@ void StdCmdSceneInspector::activated(int iMsg) Q_UNUSED(iMsg); Gui::Document* doc = Application::Instance->activeDocument(); if (doc) { - static QPointer dlg = 0; + static QPointer dlg = nullptr; if (!dlg) dlg = new Gui::Dialog::DlgInspector(getMainWindow()); dlg->setDocument(doc); @@ -3304,7 +3304,7 @@ bool StdCmdTextureMapping::isActive(void) { Gui::MDIView* view = getMainWindow()->activeWindow(); return view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId()) - && (Gui::Control().activeDialog()==0); + && (Gui::Control().activeDialog()==nullptr); } DEF_STD_CMD(StdCmdDemoMode) @@ -3324,7 +3324,7 @@ StdCmdDemoMode::StdCmdDemoMode() void StdCmdDemoMode::activated(int iMsg) { Q_UNUSED(iMsg); - static QPointer dlg = 0; + static QPointer dlg = nullptr; if (!dlg) dlg = new Gui::Dialog::DemoMode(getMainWindow()); dlg->setAttribute(Qt::WA_DeleteOnClose); diff --git a/src/Gui/Control.cpp b/src/Gui/Control.cpp index 0e14cab451..38eb27e7ed 100644 --- a/src/Gui/Control.cpp +++ b/src/Gui/Control.cpp @@ -45,11 +45,11 @@ using namespace std; /* TRANSLATOR Gui::ControlSingleton */ -ControlSingleton* ControlSingleton::_pcSingleton = 0; -static QPointer _taskPanel = 0; +ControlSingleton* ControlSingleton::_pcSingleton = nullptr; +static QPointer _taskPanel = nullptr; ControlSingleton::ControlSingleton() - : ActiveDialog(0) + : ActiveDialog(nullptr) { } @@ -71,7 +71,7 @@ Gui::TaskView::TaskView* ControlSingleton::taskPanel() const return _taskPanel; // no task panel available else - return 0; + return nullptr; } void ControlSingleton::showTaskView() @@ -164,7 +164,7 @@ QTabWidget* ControlSingleton::tabPanel() const // should return the pointer to combo view if (pcComboView) return pcComboView->getTabPanel(); - return 0; + return nullptr; } Gui::TaskView::TaskDialog* ControlSingleton::activeDialog() const @@ -216,7 +216,7 @@ void ControlSingleton::closeDialog() void ControlSingleton::closedDialog() { - ActiveDialog = 0; + ActiveDialog = nullptr; Gui::DockWnd::ComboView* pcComboView = qobject_cast (Gui::DockWindowManager::instance()->getDockWindow("Combo View")); // should return the pointer to combo view @@ -256,16 +256,16 @@ bool ControlSingleton::isAllowedAlterSelection(void) const ControlSingleton& ControlSingleton::instance(void) { - if (_pcSingleton == NULL) + if (_pcSingleton == nullptr) _pcSingleton = new ControlSingleton; return *_pcSingleton; } void ControlSingleton::destruct (void) { - if (_pcSingleton != NULL) + if (_pcSingleton != nullptr) delete _pcSingleton; - _pcSingleton = 0; + _pcSingleton = nullptr; } diff --git a/src/Gui/DAGView/DAGModel.h b/src/Gui/DAGView/DAGModel.h index 3b71129a8a..80dc4d8645 100644 --- a/src/Gui/DAGView/DAGModel.h +++ b/src/Gui/DAGView/DAGModel.h @@ -52,7 +52,7 @@ namespace Gui { Q_OBJECT public: - LineEdit(QWidget *parentIn = 0); + LineEdit(QWidget *parentIn = nullptr); Q_SIGNALS: void acceptedSignal(); void rejectedSignal(); diff --git a/src/Gui/DAGView/DAGRectItem.h b/src/Gui/DAGView/DAGRectItem.h index df9078b810..9537e1df19 100644 --- a/src/Gui/DAGView/DAGRectItem.h +++ b/src/Gui/DAGView/DAGRectItem.h @@ -37,7 +37,7 @@ namespace Gui class RectItem : public QGraphicsRectItem { public: - RectItem(QGraphicsItem* parent = 0); + RectItem(QGraphicsItem* parent = nullptr); void setBackgroundBrush(const QBrush &brushIn){backgroundBrush = brushIn;} void setEditingBrush(const QBrush &brushIn){editBrush = brushIn;} void preHighlightOn(){preSelected = true;} @@ -50,7 +50,7 @@ namespace Gui void editingFinished(){editing = false;} bool isEditing(){return editing;} protected: - virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr); private: QBrush backgroundBrush; //!< brush used for background. not used yet. QBrush editBrush; //!< brush used when object is in edit mode. diff --git a/src/Gui/DAGView/DAGView.h b/src/Gui/DAGView/DAGView.h index b622be22b6..f6329e8d08 100644 --- a/src/Gui/DAGView/DAGView.h +++ b/src/Gui/DAGView/DAGView.h @@ -43,7 +43,7 @@ namespace Gui { Q_OBJECT public: - View(QWidget *parentIn = 0); + View(QWidget *parentIn = nullptr); virtual ~View() override; public Q_SLOTS: @@ -66,7 +66,7 @@ namespace Gui { Q_OBJECT public: - DockWindow(Gui::Document* gDocumentIn = 0, QWidget *parent = 0); + DockWindow(Gui::Document* gDocumentIn = nullptr, QWidget *parent = nullptr); ~DockWindow(){} private: diff --git a/src/Gui/DemoMode.h b/src/Gui/DemoMode.h index 70755b33f6..284772113b 100644 --- a/src/Gui/DemoMode.h +++ b/src/Gui/DemoMode.h @@ -43,7 +43,7 @@ class GuiExport DemoMode : public QDialog Q_OBJECT public: - DemoMode(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DemoMode(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DemoMode(); void accept(); diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index 471c9213db..1cfb23a547 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -601,7 +601,7 @@ void IconFolders::removeFolder() addButton->setEnabled(true); QPushButton* remove = static_cast(sender()); - QLineEdit* edit = 0; + QLineEdit* edit = nullptr; for (QList< QPair >::iterator it = buttonMap.begin(); it != buttonMap.end(); ++it) { if (it->second == remove) { edit = it->first; diff --git a/src/Gui/DlgActionsImp.h b/src/Gui/DlgActionsImp.h index 2168841567..6770fb5a05 100644 --- a/src/Gui/DlgActionsImp.h +++ b/src/Gui/DlgActionsImp.h @@ -53,7 +53,7 @@ class DlgCustomActionsImp : public CustomizeActionPage Q_OBJECT public: - DlgCustomActionsImp( QWidget* parent = 0 ); + DlgCustomActionsImp( QWidget* parent = nullptr ); ~DlgCustomActionsImp(); Q_SIGNALS: diff --git a/src/Gui/DlgActivateWindowImp.cpp b/src/Gui/DlgActivateWindowImp.cpp index d6eac069f2..d8a346381f 100644 --- a/src/Gui/DlgActivateWindowImp.cpp +++ b/src/Gui/DlgActivateWindowImp.cpp @@ -50,7 +50,7 @@ DlgActivateWindowImp::DlgActivateWindowImp(QWidget* parent, Qt::WindowFlags fl) ui->setupUi(this); QPushButton* buttonOk = ui->buttonBox->button(QDialogButtonBox::Ok); buttonOk->setText(QApplication::translate("Gui::Dialog::DlgActivateWindow", "&Activate")); - QTreeWidgetItem* active=0; + QTreeWidgetItem* active=nullptr; QStringList labels; labels << tr("Windows"); ui->treeWidget->setHeaderLabels(labels); ui->treeWidget->header()->hide(); diff --git a/src/Gui/DlgActivateWindowImp.h b/src/Gui/DlgActivateWindowImp.h index 96eedd266b..33537dc43b 100644 --- a/src/Gui/DlgActivateWindowImp.h +++ b/src/Gui/DlgActivateWindowImp.h @@ -40,7 +40,7 @@ class DlgActivateWindowImp : public QDialog Q_OBJECT public: - DlgActivateWindowImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgActivateWindowImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgActivateWindowImp(); protected: diff --git a/src/Gui/DlgCheckableMessageBox.cpp b/src/Gui/DlgCheckableMessageBox.cpp index a36fe198e4..44a992b847 100644 --- a/src/Gui/DlgCheckableMessageBox.cpp +++ b/src/Gui/DlgCheckableMessageBox.cpp @@ -86,7 +86,7 @@ void DlgCheckableMessageBox::showMessage(const QString& header, const QString& m } struct DlgCheckableMessageBoxPrivate { - DlgCheckableMessageBoxPrivate() : clickedButton(0) {} + DlgCheckableMessageBoxPrivate() : clickedButton(nullptr) {} Ui::DlgCheckableMessageBox ui; QAbstractButton *clickedButton; diff --git a/src/Gui/DlgCommandsImp.h b/src/Gui/DlgCommandsImp.h index 14ba17ed55..b7b2a07207 100644 --- a/src/Gui/DlgCommandsImp.h +++ b/src/Gui/DlgCommandsImp.h @@ -46,7 +46,7 @@ class DlgCustomCommandsImp : public CustomizeActionPage Q_OBJECT public: - DlgCustomCommandsImp(QWidget* parent = 0); + DlgCustomCommandsImp(QWidget* parent = nullptr); ~DlgCustomCommandsImp(); protected Q_SLOTS: diff --git a/src/Gui/DlgCustomizeImp.h b/src/Gui/DlgCustomizeImp.h index d4a47ff72e..a12f372b71 100644 --- a/src/Gui/DlgCustomizeImp.h +++ b/src/Gui/DlgCustomizeImp.h @@ -51,7 +51,7 @@ class DlgCustomizeImp : public QDialog Q_OBJECT public: - DlgCustomizeImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgCustomizeImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgCustomizeImp(); static void addPage(const char* className); diff --git a/src/Gui/DlgCustomizeSpNavSettings.h b/src/Gui/DlgCustomizeSpNavSettings.h index 367964bed9..7a74ffcef5 100644 --- a/src/Gui/DlgCustomizeSpNavSettings.h +++ b/src/Gui/DlgCustomizeSpNavSettings.h @@ -39,7 +39,7 @@ namespace Gui Q_OBJECT public: - explicit DlgCustomizeSpNavSettings(QWidget *parent = 0); + explicit DlgCustomizeSpNavSettings(QWidget *parent = nullptr); ~DlgCustomizeSpNavSettings(); protected Q_SLOTS: diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/DlgCustomizeSpaceball.cpp index c1837359fe..884aa3d702 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/DlgCustomizeSpaceball.cpp @@ -338,9 +338,9 @@ void CommandView::goClicked(const QModelIndex &index) CommandNode::CommandNode(NodeType typeIn) { nodeType = typeIn; - parent = 0; + parent = nullptr; children.clear(); - aCommand = 0; + aCommand = nullptr; } CommandNode::~CommandNode() @@ -352,14 +352,14 @@ CommandNode::~CommandNode() CommandModel::CommandModel(QObject *parent) : QAbstractItemModel(parent) { - rootNode = 0; + rootNode = nullptr; initialize(); } CommandModel::~CommandModel() { delete rootNode; - rootNode = 0; + rootNode = nullptr; } QModelIndex CommandModel::index(int row, int column, const QModelIndex &parent) const @@ -509,7 +509,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName) else macrosIndex = indexList.at(0); - Command *command = 0; + Command *command = nullptr; command = Application::Instance->commandManager().getCommandByName(macroName); if (!command) return; diff --git a/src/Gui/DlgCustomizeSpaceball.h b/src/Gui/DlgCustomizeSpaceball.h index 9226907c25..3bede9957a 100644 --- a/src/Gui/DlgCustomizeSpaceball.h +++ b/src/Gui/DlgCustomizeSpaceball.h @@ -44,7 +44,7 @@ namespace Gui { Q_OBJECT public: - ButtonView(QWidget *parent = 0); + ButtonView(QWidget *parent = nullptr); void selectButton(int number); Q_SIGNALS: void changeCommandSelection(const QString& commandName); @@ -79,7 +79,7 @@ namespace Gui { Q_OBJECT public: - CommandView(QWidget *parent = 0); + CommandView(QWidget *parent = nullptr); public Q_SLOTS: void goChangeCommandSelection(const QString& commandName); private Q_SLOTS: @@ -107,7 +107,7 @@ namespace Gui { Q_OBJECT public: - CommandModel(QObject *parent = 0); + CommandModel(QObject *parent = nullptr); ~CommandModel(); virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; virtual QModelIndex parent(const QModelIndex &index) const; @@ -144,7 +144,7 @@ namespace Gui { Q_OBJECT public: - DlgCustomizeSpaceball(QWidget *parent = 0); + DlgCustomizeSpaceball(QWidget *parent = nullptr); virtual ~DlgCustomizeSpaceball(); protected: void changeEvent(QEvent *e); diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index 736119cac3..75cec6e3e7 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -252,7 +252,7 @@ void DlgDisplayPropertiesImp::on_buttonUserDefinedMaterial_clicked() void DlgDisplayPropertiesImp::on_buttonColorPlot_clicked() { std::vector Provider = getSelection(); - static QPointer dlg = 0; + static QPointer dlg = nullptr; if (!dlg) dlg = new DlgMaterialPropertiesImp("TextureMaterial", this); dlg->setModal(false); @@ -638,7 +638,7 @@ TaskDisplayProperties::TaskDisplayProperties() this->setButtonPosition(TaskDisplayProperties::South); widget = new DlgDisplayPropertiesImp(false); widget->showDefaultButtons(false); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Gui/DlgEditFileIncludePropertyExternal.h b/src/Gui/DlgEditFileIncludePropertyExternal.h index 92c14f5f36..a31b7c6f0e 100644 --- a/src/Gui/DlgEditFileIncludePropertyExternal.h +++ b/src/Gui/DlgEditFileIncludePropertyExternal.h @@ -39,7 +39,7 @@ class GuiExport DlgEditFileIncludePropertyExternal : public DlgRunExternal Q_OBJECT public: - DlgEditFileIncludePropertyExternal( App::PropertyFileIncluded& Prop, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgEditFileIncludePropertyExternal( App::PropertyFileIncluded& Prop, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); virtual ~DlgEditFileIncludePropertyExternal(); int Do(void); diff --git a/src/Gui/DlgEditorImp.h b/src/Gui/DlgEditorImp.h index bbebda51de..70fa688e38 100644 --- a/src/Gui/DlgEditorImp.h +++ b/src/Gui/DlgEditorImp.h @@ -45,7 +45,7 @@ class DlgSettingsEditorImp : public PreferencePage Q_OBJECT public: - DlgSettingsEditorImp( QWidget* parent = 0 ); + DlgSettingsEditorImp( QWidget* parent = nullptr ); ~DlgSettingsEditorImp(); public: diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index 027acec480..f6123b2cf2 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -45,13 +45,13 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, const Base::Unit & _impliedUnit, QWidget *parent) : QDialog(parent) , ui(new Ui::DlgExpressionInput) - , expression(_expression ? _expression->copy() : 0) + , expression(_expression ? _expression->copy() : nullptr) , path(_path) , discarded(false) , impliedUnit(_impliedUnit) , minimumWidth(10) { - assert(path.getDocumentObject() != 0); + assert(path.getDocumentObject() != nullptr); // Setup UI ui->setupUi(this); diff --git a/src/Gui/DlgExpressionInput.h b/src/Gui/DlgExpressionInput.h index e656ebff53..7fbb85ba62 100644 --- a/src/Gui/DlgExpressionInput.h +++ b/src/Gui/DlgExpressionInput.h @@ -51,7 +51,7 @@ class GuiExport DlgExpressionInput : public QDialog Q_OBJECT public: - explicit DlgExpressionInput(const App::ObjectIdentifier & _path, std::shared_ptr _expression, const Base::Unit &_impliedUnit, QWidget *parent = 0); + explicit DlgExpressionInput(const App::ObjectIdentifier & _path, std::shared_ptr _expression, const Base::Unit &_impliedUnit, QWidget *parent = nullptr); ~DlgExpressionInput(); std::shared_ptr getExpression() const { return expression; } diff --git a/src/Gui/DlgGeneralImp.h b/src/Gui/DlgGeneralImp.h index e0a75da8da..0db19ec8ed 100644 --- a/src/Gui/DlgGeneralImp.h +++ b/src/Gui/DlgGeneralImp.h @@ -45,7 +45,7 @@ class DlgGeneralImp : public PreferencePage Q_OBJECT public: - DlgGeneralImp( QWidget* parent = 0 ); + DlgGeneralImp( QWidget* parent = nullptr ); ~DlgGeneralImp(); void saveSettings(); diff --git a/src/Gui/DlgInputDialogImp.cpp b/src/Gui/DlgInputDialogImp.cpp index 36825f8379..66458bb1a3 100644 --- a/src/Gui/DlgInputDialogImp.cpp +++ b/src/Gui/DlgInputDialogImp.cpp @@ -92,7 +92,7 @@ void DlgInputDialogImp::setType( DlgInputDialogImp::Type t ) { inputtype = t; - QWidget *input = 0; + QWidget *input = nullptr; switch (inputtype) { case LineEdit: diff --git a/src/Gui/DlgInputDialogImp.h b/src/Gui/DlgInputDialogImp.h index f6788ae0b7..d658f3c03f 100644 --- a/src/Gui/DlgInputDialogImp.h +++ b/src/Gui/DlgInputDialogImp.h @@ -52,7 +52,7 @@ class GuiExport DlgInputDialogImp : public QDialog public: enum Type { LineEdit, SpinBox, UIntBox, FloatSpinBox, ComboBox }; - DlgInputDialogImp( const QString& label, QWidget* parent = 0, bool modal = true, Type = LineEdit ); + DlgInputDialogImp( const QString& label, QWidget* parent = nullptr, bool modal = true, Type = LineEdit ); ~DlgInputDialogImp(); void setType( Type t ); diff --git a/src/Gui/DlgKeyboardImp.h b/src/Gui/DlgKeyboardImp.h index 682e95458f..8626c8996e 100644 --- a/src/Gui/DlgKeyboardImp.h +++ b/src/Gui/DlgKeyboardImp.h @@ -45,7 +45,7 @@ class DlgCustomKeyboardImp : public CustomizeActionPage Q_OBJECT public: - DlgCustomKeyboardImp( QWidget* parent = 0 ); + DlgCustomKeyboardImp( QWidget* parent = nullptr ); ~DlgCustomKeyboardImp(); protected: diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index 89bf6704eb..14430ddf07 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -310,7 +310,7 @@ void DlgMacroExecuteImp::on_fileChooser_fileNameChanged(const QString& fn) void DlgMacroExecuteImp::on_editButton_clicked() { QDir dir; - QTreeWidgetItem* item = 0; + QTreeWidgetItem* item = nullptr; int index = ui->tabMacroWidget->currentIndex(); if (index == 0) { //user-specific @@ -672,7 +672,7 @@ Note: your changes will be applied when you next switch workbenches\n")); void DlgMacroExecuteImp::on_renameButton_clicked() { QDir dir; - QTreeWidgetItem* item = 0; + QTreeWidgetItem* item = nullptr; int index = ui->tabMacroWidget->currentIndex(); if (index == 0) { //user-specific @@ -729,7 +729,7 @@ void DlgMacroExecuteImp::on_renameButton_clicked() void DlgMacroExecuteImp::on_duplicateButton_clicked() { QDir dir; - QTreeWidgetItem* item = 0; + QTreeWidgetItem* item = nullptr; //When duplicating a macro we can either begin trying to find a unique name with @001 or begin with the current @NNN if applicable diff --git a/src/Gui/DlgMacroExecuteImp.h b/src/Gui/DlgMacroExecuteImp.h index ced31d1585..5d92c6ce1a 100644 --- a/src/Gui/DlgMacroExecuteImp.h +++ b/src/Gui/DlgMacroExecuteImp.h @@ -44,7 +44,7 @@ class DlgMacroExecuteImp : public QDialog, public Gui::WindowParameter Q_OBJECT public: - DlgMacroExecuteImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgMacroExecuteImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~DlgMacroExecuteImp(); void accept(); diff --git a/src/Gui/DlgMacroRecordImp.cpp b/src/Gui/DlgMacroRecordImp.cpp index 95b359dc9b..deea7a0cc4 100644 --- a/src/Gui/DlgMacroRecordImp.cpp +++ b/src/Gui/DlgMacroRecordImp.cpp @@ -150,7 +150,7 @@ void DlgMacroRecordImp::on_buttonStop_clicked() void DlgMacroRecordImp::on_pushButtonChooseDir_clicked() { - QString newDir = QFileDialog::getExistingDirectory(0,tr("Choose macro directory"),macroPath); + QString newDir = QFileDialog::getExistingDirectory(nullptr,tr("Choose macro directory"),macroPath); if (!newDir.isEmpty()) { macroPath = QDir::toNativeSeparators(newDir + QDir::separator()); ui->lineEditMacroPath->setText(macroPath); diff --git a/src/Gui/DlgMacroRecordImp.h b/src/Gui/DlgMacroRecordImp.h index 2ee992749d..349751b064 100644 --- a/src/Gui/DlgMacroRecordImp.h +++ b/src/Gui/DlgMacroRecordImp.h @@ -42,7 +42,7 @@ class DlgMacroRecordImp : public QDialog, public Gui::WindowParameter Q_OBJECT public: - DlgMacroRecordImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgMacroRecordImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); virtual ~DlgMacroRecordImp(); protected Q_SLOTS: diff --git a/src/Gui/DlgMaterialPropertiesImp.h b/src/Gui/DlgMaterialPropertiesImp.h index 9ba6a60a83..5ef5273fcf 100644 --- a/src/Gui/DlgMaterialPropertiesImp.h +++ b/src/Gui/DlgMaterialPropertiesImp.h @@ -39,7 +39,7 @@ class DlgMaterialPropertiesImp : public QDialog Q_OBJECT public: - DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgMaterialPropertiesImp(); void setViewProviders(const std::vector&); QColor diffuseColor() const; diff --git a/src/Gui/DlgObjectSelection.cpp b/src/Gui/DlgObjectSelection.cpp index c829c74666..1526a8053c 100644 --- a/src/Gui/DlgObjectSelection.cpp +++ b/src/Gui/DlgObjectSelection.cpp @@ -83,7 +83,7 @@ DlgObjectSelection::DlgObjectSelection( } for(auto obj : objs) { auto &info = objMap[obj]; - info.items.push_back(createItem(obj,0)); + info.items.push_back(createItem(obj,nullptr)); info.items.back()->setCheckState(0,Qt::Checked); } @@ -201,7 +201,7 @@ App::DocumentObject *DlgObjectSelection::objFromItem(QTreeWidgetItem *item) { name = qPrintable(item->text(2)); } auto doc = App::GetApplication().getDocument(docName.c_str()); - if(!doc) return 0; + if(!doc) return nullptr; return doc->getObject(name.c_str()); } @@ -326,7 +326,7 @@ std::vector DlgObjectSelection::getSelections() const { void DlgObjectSelection::onItemSelectionChanged() { SignalBlocker block2(ui->treeWidget); SignalBlocker block(ui->depList); - QTreeWidgetItem *scroll=0; + QTreeWidgetItem *scroll=nullptr; for(auto &v : objMap) { auto &info = v.second; auto it = sels.find(v.first); @@ -353,7 +353,7 @@ void DlgObjectSelection::onItemSelectionChanged() { void DlgObjectSelection::onDepSelectionChanged() { SignalBlocker block2(ui->treeWidget); SignalBlocker block(ui->depList); - QTreeWidgetItem *scroll=0; + QTreeWidgetItem *scroll=nullptr; for(auto &v : objMap) { auto &info = v.second; auto it = sels.find(v.first); diff --git a/src/Gui/DlgObjectSelection.h b/src/Gui/DlgObjectSelection.h index 060cda0276..8c1adf4240 100644 --- a/src/Gui/DlgObjectSelection.h +++ b/src/Gui/DlgObjectSelection.h @@ -33,7 +33,7 @@ class GuiExport DlgObjectSelection : public QDialog public: DlgObjectSelection(const std::vector &objs, - QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgObjectSelection(); std::vector getSelections() const; @@ -59,7 +59,7 @@ private: std::map inList; std::map outList; std::vector items; - QTreeWidgetItem *depItem = 0; + QTreeWidgetItem *depItem = nullptr; Qt::CheckState checkState = Qt::Checked; }; std::map objMap; diff --git a/src/Gui/DlgOnlineHelpImp.h b/src/Gui/DlgOnlineHelpImp.h index 912217c23b..ac3e4dea6f 100644 --- a/src/Gui/DlgOnlineHelpImp.h +++ b/src/Gui/DlgOnlineHelpImp.h @@ -41,7 +41,7 @@ class DlgOnlineHelpImp : public PreferencePage Q_OBJECT public: - DlgOnlineHelpImp( QWidget* parent = 0 ); + DlgOnlineHelpImp( QWidget* parent = nullptr ); ~DlgOnlineHelpImp(); static QString getStartpage(); diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 2dfb326daa..543ad7376a 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -386,7 +386,7 @@ void DlgParameterImp::onChangeParameterSet(int itemPos) QStringList paths = path.split(QLatin1String("."), QString::SkipEmptyParts); #endif - QTreeWidgetItem* parent = 0; + QTreeWidgetItem* parent = nullptr; for (int index=0; index < paramGroup->topLevelItemCount() && !paths.empty(); index++) { QTreeWidgetItem* child = paramGroup->topLevelItem(index); if (child->text(0) == paths.front()) { @@ -398,7 +398,7 @@ void DlgParameterImp::onChangeParameterSet(int itemPos) while (parent && !paths.empty()) { parent->setExpanded(true); QTreeWidgetItem* item = parent; - parent = 0; + parent = nullptr; for (int index=0; index < item->childCount(); index++) { QTreeWidgetItem* child = item->child(index); if (child->text(0) == paths.front()) { diff --git a/src/Gui/DlgParameterImp.h b/src/Gui/DlgParameterImp.h index 8963f066f0..339c898018 100644 --- a/src/Gui/DlgParameterImp.h +++ b/src/Gui/DlgParameterImp.h @@ -47,7 +47,7 @@ class GuiExport DlgParameterImp : public QDialog Q_OBJECT public: - DlgParameterImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgParameterImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~DlgParameterImp(); void accept(); @@ -95,7 +95,7 @@ class ParameterGroup : public QTreeWidget Q_OBJECT public: - ParameterGroup( QWidget * parent = 0 ); + ParameterGroup( QWidget * parent = nullptr ); virtual ~ParameterGroup(); protected: @@ -147,7 +147,7 @@ class ParameterValue : public QTreeWidget Q_OBJECT public: - ParameterValue( QWidget * parent = 0 ); + ParameterValue( QWidget * parent = nullptr ); virtual ~ParameterValue(); /** Sets the current parameter group that is displayed. */ diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/DlgPreferencesImp.cpp index e3113925f7..22a2b84e5f 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/DlgPreferencesImp.cpp @@ -359,7 +359,7 @@ void DlgPreferencesImp::applyChanges() int index = page->metaObject()->indexOfMethod("checkSettings()"); try { if (index >= 0) { - page->qt_metacall(QMetaObject::InvokeMetaMethod, index, 0); + page->qt_metacall(QMetaObject::InvokeMetaMethod, index, nullptr); } } catch (const Base::Exception& e) { diff --git a/src/Gui/DlgPreferencesImp.h b/src/Gui/DlgPreferencesImp.h index d0ec3e3cbe..c7aa1e44d2 100644 --- a/src/Gui/DlgPreferencesImp.h +++ b/src/Gui/DlgPreferencesImp.h @@ -116,7 +116,7 @@ public: static void removePage(const std::string& className, const std::string& group); static void reloadSettings(); - DlgPreferencesImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgPreferencesImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgPreferencesImp(); void accept(); diff --git a/src/Gui/DlgProjectInformationImp.h b/src/Gui/DlgProjectInformationImp.h index 7ef387f12f..c068f91526 100644 --- a/src/Gui/DlgProjectInformationImp.h +++ b/src/Gui/DlgProjectInformationImp.h @@ -40,7 +40,7 @@ class DlgProjectInformationImp : public QDialog Q_OBJECT public: - DlgProjectInformationImp(App::Document* doc, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgProjectInformationImp(App::Document* doc, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgProjectInformationImp(); void accept(); diff --git a/src/Gui/DlgProjectUtility.h b/src/Gui/DlgProjectUtility.h index 9363b75b0f..3a44c86186 100644 --- a/src/Gui/DlgProjectUtility.h +++ b/src/Gui/DlgProjectUtility.h @@ -35,7 +35,7 @@ class DlgProjectUtility : public QDialog Q_OBJECT public: - DlgProjectUtility(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgProjectUtility(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgProjectUtility(); private Q_SLOTS: diff --git a/src/Gui/DlgPropertyLink.cpp b/src/Gui/DlgPropertyLink.cpp index 41fd0ad56d..b6a16e14b0 100644 --- a/src/Gui/DlgPropertyLink.cpp +++ b/src/Gui/DlgPropertyLink.cpp @@ -52,7 +52,7 @@ using namespace Gui::Dialog; class ItemDelegate: public QStyledItemDelegate { public: - ItemDelegate(QObject* parent=0): QStyledItemDelegate(parent) {} + ItemDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {} virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const @@ -120,7 +120,7 @@ QList DlgPropertyLink::getLinksFromProperty(const App::Property prop->getLinks(objs,true,&subs,false); if(subs.empty()) { for(auto obj : objs) - res.push_back(App::SubObjectT(obj,0)); + res.push_back(App::SubObjectT(obj,nullptr)); } else if (objs.size()==1) { for(auto &sub : subs) res.push_back(App::SubObjectT(objs.front(),sub.c_str())); @@ -195,7 +195,7 @@ QString DlgPropertyLink::formatLinks(App::Document *ownerDoc, QList= 3) break; } - return QString::fromLatin1("%1 [%2%3]").arg(formatObject(ownerDoc,obj,0), + return QString::fromLatin1("%1 [%2%3]").arg(formatObject(ownerDoc,obj,nullptr), list.join(QLatin1String(", ")), QLatin1String(links.size()>3?" ...":"")); } @@ -490,7 +490,7 @@ void DlgPropertyLink::onItemSelectionChanged() if(newSelections.isEmpty() || selections.contains(newSelections.back())) { selections = newSelections; if(newSelections.isEmpty()) - currentObj = 0; + currentObj = nullptr; return; } @@ -554,14 +554,14 @@ QTreeWidgetItem *DlgPropertyLink::findItem( *pfound = false; if(!obj || !obj->getNameInDocument()) - return 0; + return nullptr; std::vector sobjs; if(subname && subname[0]) { if(!allowSubObject) { obj = obj->getSubObject(subname); if(!obj) - return 0; + return nullptr; } else { sobjs = obj->getSubObjectList(subname); } @@ -569,12 +569,12 @@ QTreeWidgetItem *DlgPropertyLink::findItem( auto itDoc = docItems.find(obj->getDocument()); if(itDoc == docItems.end()) - return 0; + return nullptr; onItemExpanded(itDoc->second); auto it = itemMap.find(obj); if(it == itemMap.end() || it->second->isHidden()) - return 0; + return nullptr; if(!allowSubObject) { if(pfound) @@ -872,15 +872,15 @@ QTreeWidgetItem *DlgPropertyLink::createItem( App::DocumentObject *obj, QTreeWidgetItem *parent) { if(!obj || !obj->getNameInDocument()) - return 0; + return nullptr; if(inList.find(obj)!=inList.end()) - return 0; + return nullptr; auto vp = Base::freecad_dynamic_cast( Application::Instance->getViewProvider(obj)); if(!vp) - return 0; + return nullptr; QTreeWidgetItem* item; if(parent) @@ -909,7 +909,7 @@ QTreeWidgetItem *DlgPropertyLink::createItem( Base::PyGILStateLocker lock; Py::Object proxy = prop->getValue(); if(!proxy.isNone() && !proxy.isString()) { - const char *name = 0; + const char *name = nullptr; if (proxy.hasAttr("__class__")) proxyType = QByteArray(proxy.getAttr("__class__").as_string().c_str()); else { @@ -931,9 +931,9 @@ QTreeWidgetItem *DlgPropertyLink::createItem( QTreeWidgetItem *DlgPropertyLink::createTypeItem(Base::Type type) { if(type.isBad()) - return 0; + return nullptr; - QTreeWidgetItem *item = 0; + QTreeWidgetItem *item = nullptr; if(!type.isBad() && type!=App::DocumentObject::getClassTypeId()) { Base::Type parentType = type.getParent(); if(!parentType.isBad()) { @@ -961,7 +961,7 @@ QTreeWidgetItem *DlgPropertyLink::createTypeItem(Base::Type type) { bool DlgPropertyLink::filterType(QTreeWidgetItem *item) { auto proxyType = item->data(0, Qt::UserRole+3).toByteArray(); - QTreeWidgetItem *proxyItem = 0; + QTreeWidgetItem *proxyItem = nullptr; if(proxyType.size()) { auto &pitem = typeItems[proxyType]; if(!pitem) { diff --git a/src/Gui/DlgPropertyLink.h b/src/Gui/DlgPropertyLink.h index e7b242e92d..42b7362901 100644 --- a/src/Gui/DlgPropertyLink.h +++ b/src/Gui/DlgPropertyLink.h @@ -39,7 +39,7 @@ class DlgPropertyLink : public QDialog, public Gui::SelectionObserver Q_OBJECT public: - DlgPropertyLink(QWidget* parent = 0); + DlgPropertyLink(QWidget* parent = nullptr); ~DlgPropertyLink(); void accept(); @@ -91,7 +91,7 @@ private: void filterObjects(); void filterItem(QTreeWidgetItem *item); bool filterType(QTreeWidgetItem *item); - QTreeWidgetItem *findItem(App::DocumentObject *obj, const char *subname=0, bool *found=nullptr); + QTreeWidgetItem *findItem(App::DocumentObject *obj, const char *subname=nullptr, bool *found=nullptr); void itemSearch(const QString &text, bool select); QList getLinkFromItem(QTreeWidgetItem *, bool needSubName=true) const; diff --git a/src/Gui/DlgReportViewImp.h b/src/Gui/DlgReportViewImp.h index b4565b97f2..d2af172577 100644 --- a/src/Gui/DlgReportViewImp.h +++ b/src/Gui/DlgReportViewImp.h @@ -40,7 +40,7 @@ class DlgReportViewImp : public PreferencePage Q_OBJECT public: - DlgReportViewImp( QWidget* parent = 0 ); + DlgReportViewImp( QWidget* parent = nullptr ); ~DlgReportViewImp(); void saveSettings(); diff --git a/src/Gui/DlgRevertToBackupConfigImp.h b/src/Gui/DlgRevertToBackupConfigImp.h index ce572fb42c..cf42a7504c 100644 --- a/src/Gui/DlgRevertToBackupConfigImp.h +++ b/src/Gui/DlgRevertToBackupConfigImp.h @@ -39,7 +39,7 @@ class DlgRevertToBackupConfigImp : public QDialog Q_OBJECT public: - DlgRevertToBackupConfigImp( QWidget* parent = 0 ); + DlgRevertToBackupConfigImp( QWidget* parent = nullptr ); ~DlgRevertToBackupConfigImp(); public Q_SLOTS: diff --git a/src/Gui/DlgRunExternal.h b/src/Gui/DlgRunExternal.h index e885c74cca..8fd7033908 100644 --- a/src/Gui/DlgRunExternal.h +++ b/src/Gui/DlgRunExternal.h @@ -40,7 +40,7 @@ class GuiExport DlgRunExternal : public QDialog Q_OBJECT public: - DlgRunExternal(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgRunExternal(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); virtual ~DlgRunExternal(); int Do(void); diff --git a/src/Gui/DlgSettings3DViewImp.h b/src/Gui/DlgSettings3DViewImp.h index 1dee60d09e..76451c572c 100644 --- a/src/Gui/DlgSettings3DViewImp.h +++ b/src/Gui/DlgSettings3DViewImp.h @@ -43,7 +43,7 @@ class DlgSettings3DViewImp : public PreferencePage Q_OBJECT public: - DlgSettings3DViewImp(QWidget* parent = 0); + DlgSettings3DViewImp(QWidget* parent = nullptr); ~DlgSettings3DViewImp(); void saveSettings(); diff --git a/src/Gui/DlgSettingsColorGradientImp.h b/src/Gui/DlgSettingsColorGradientImp.h index c4412c5888..a49fd18017 100644 --- a/src/Gui/DlgSettingsColorGradientImp.h +++ b/src/Gui/DlgSettingsColorGradientImp.h @@ -44,7 +44,7 @@ class DlgSettingsColorGradientImp : public QDialog Q_OBJECT public: - DlgSettingsColorGradientImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgSettingsColorGradientImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~DlgSettingsColorGradientImp(); void accept(); diff --git a/src/Gui/DlgSettingsDocumentImp.h b/src/Gui/DlgSettingsDocumentImp.h index c4bac8bffc..78663d1729 100644 --- a/src/Gui/DlgSettingsDocumentImp.h +++ b/src/Gui/DlgSettingsDocumentImp.h @@ -41,7 +41,7 @@ class DlgSettingsDocumentImp : public PreferencePage Q_OBJECT public: - DlgSettingsDocumentImp( QWidget* parent = 0 ); + DlgSettingsDocumentImp( QWidget* parent = nullptr ); ~DlgSettingsDocumentImp(); void saveSettings(); diff --git a/src/Gui/DlgSettingsImageImp.h b/src/Gui/DlgSettingsImageImp.h index 7c9a8fed00..67c8176122 100644 --- a/src/Gui/DlgSettingsImageImp.h +++ b/src/Gui/DlgSettingsImageImp.h @@ -43,7 +43,7 @@ class DlgSettingsImageImp : public QWidget Q_OBJECT public: - DlgSettingsImageImp( QWidget* parent = 0 ); + DlgSettingsImageImp( QWidget* parent = nullptr ); ~DlgSettingsImageImp(); /** @name Image dimensions */ diff --git a/src/Gui/DlgSettingsLazyLoadedImp.h b/src/Gui/DlgSettingsLazyLoadedImp.h index 4521afc023..ce52286423 100644 --- a/src/Gui/DlgSettingsLazyLoadedImp.h +++ b/src/Gui/DlgSettingsLazyLoadedImp.h @@ -44,7 +44,7 @@ class DlgSettingsLazyLoadedImp : public PreferencePage Q_OBJECT public: - DlgSettingsLazyLoadedImp( QWidget* parent = 0 ); + DlgSettingsLazyLoadedImp( QWidget* parent = nullptr ); ~DlgSettingsLazyLoadedImp(); void saveSettings(); diff --git a/src/Gui/DlgSettingsMacroImp.h b/src/Gui/DlgSettingsMacroImp.h index 646fad6092..08febd279a 100644 --- a/src/Gui/DlgSettingsMacroImp.h +++ b/src/Gui/DlgSettingsMacroImp.h @@ -41,7 +41,7 @@ class DlgSettingsMacroImp : public PreferencePage Q_OBJECT public: - DlgSettingsMacroImp( QWidget* parent = 0 ); + DlgSettingsMacroImp( QWidget* parent = nullptr ); ~DlgSettingsMacroImp(); void saveSettings(); diff --git a/src/Gui/DlgSettingsNavigation.h b/src/Gui/DlgSettingsNavigation.h index 2cadd89a77..6090b3db6d 100644 --- a/src/Gui/DlgSettingsNavigation.h +++ b/src/Gui/DlgSettingsNavigation.h @@ -68,7 +68,7 @@ class CameraDialog : public QDialog Q_OBJECT public: - CameraDialog(QWidget* parent=0); + CameraDialog(QWidget* parent=nullptr); ~CameraDialog(); void setValues(double q0, double q1, double q2, double q3); void getValues(double& q0, double& q1, double& q2, double& q3) const; diff --git a/src/Gui/DlgSettingsUnitsImp.h b/src/Gui/DlgSettingsUnitsImp.h index e15992187a..aa04c77207 100644 --- a/src/Gui/DlgSettingsUnitsImp.h +++ b/src/Gui/DlgSettingsUnitsImp.h @@ -40,7 +40,7 @@ class DlgSettingsUnitsImp : public PreferencePage Q_OBJECT public: - DlgSettingsUnitsImp(QWidget* parent = 0); + DlgSettingsUnitsImp(QWidget* parent = nullptr); ~DlgSettingsUnitsImp(); void saveSettings(); diff --git a/src/Gui/DlgSettingsViewColor.h b/src/Gui/DlgSettingsViewColor.h index 12ff65125c..f3b52ec8d3 100644 --- a/src/Gui/DlgSettingsViewColor.h +++ b/src/Gui/DlgSettingsViewColor.h @@ -41,7 +41,7 @@ class DlgSettingsViewColor : public PreferencePage Q_OBJECT public: - DlgSettingsViewColor(QWidget* parent = 0); + DlgSettingsViewColor(QWidget* parent = nullptr); ~DlgSettingsViewColor(); void saveSettings(); diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 6a41964828..5851df825e 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -821,7 +821,7 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA cmd = "Separator"; } QList actions = bars.front()->actions(); - QAction* before=0; + QAction* before=nullptr; for (QList::ConstIterator it = actions.begin(); it != actions.end(); ++it) { if ((*it)->data().toByteArray() == cmd) { // if we move a separator then make sure to pick up the right one @@ -831,7 +831,7 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA continue; } } - if (before != 0) { + if (before != nullptr) { QList group = getActionGroup(*it); bars.front()->removeAction(*it); bars.front()->insertAction(before, *it); diff --git a/src/Gui/DlgToolbarsImp.h b/src/Gui/DlgToolbarsImp.h index 12a7b7ea80..496c2e1e2d 100644 --- a/src/Gui/DlgToolbarsImp.h +++ b/src/Gui/DlgToolbarsImp.h @@ -46,7 +46,7 @@ class DlgCustomToolbars : public CustomizeActionPage protected: enum Type { Toolbar, Toolboxbar }; - DlgCustomToolbars(Type, QWidget* parent = 0); + DlgCustomToolbars(Type, QWidget* parent = nullptr); virtual ~DlgCustomToolbars(); protected Q_SLOTS: @@ -94,7 +94,7 @@ class DlgCustomToolbarsImp : public DlgCustomToolbars Q_OBJECT public: - DlgCustomToolbarsImp(QWidget* parent = 0); + DlgCustomToolbarsImp(QWidget* parent = nullptr); ~DlgCustomToolbarsImp(); protected: @@ -126,7 +126,7 @@ class DlgCustomToolBoxbarsImp : public DlgCustomToolbars Q_OBJECT public: - DlgCustomToolBoxbarsImp(QWidget* parent = 0); + DlgCustomToolBoxbarsImp(QWidget* parent = nullptr); ~DlgCustomToolBoxbarsImp(); protected: diff --git a/src/Gui/DlgUndoRedo.h b/src/Gui/DlgUndoRedo.h index 300b936406..cc615b1bab 100644 --- a/src/Gui/DlgUndoRedo.h +++ b/src/Gui/DlgUndoRedo.h @@ -37,7 +37,7 @@ class UndoDialog : public QMenu Q_OBJECT public: - UndoDialog( QWidget* parent = 0 ); + UndoDialog( QWidget* parent = nullptr ); virtual ~UndoDialog(); protected Q_SLOTS: @@ -53,7 +53,7 @@ class RedoDialog : public QMenu Q_OBJECT public: - RedoDialog( QWidget* parent = 0 ); + RedoDialog( QWidget* parent = nullptr ); virtual ~RedoDialog(); protected Q_SLOTS: diff --git a/src/Gui/DlgUnitsCalculatorImp.h b/src/Gui/DlgUnitsCalculatorImp.h index 93174200c6..a060010aa2 100644 --- a/src/Gui/DlgUnitsCalculatorImp.h +++ b/src/Gui/DlgUnitsCalculatorImp.h @@ -42,7 +42,7 @@ class DlgUnitsCalculator : public QDialog Q_OBJECT public: - DlgUnitsCalculator(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgUnitsCalculator(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgUnitsCalculator(); protected: diff --git a/src/Gui/DlgWorkbenchesImp.h b/src/Gui/DlgWorkbenchesImp.h index 64097849d2..b436d7c00a 100644 --- a/src/Gui/DlgWorkbenchesImp.h +++ b/src/Gui/DlgWorkbenchesImp.h @@ -40,7 +40,7 @@ class DlgWorkbenchesImp : public CustomizeActionPage Q_OBJECT public: - DlgWorkbenchesImp(QWidget* parent = 0); + DlgWorkbenchesImp(QWidget* parent = nullptr); ~DlgWorkbenchesImp(); static QStringList load_enabled_workbenches(); static QStringList load_disabled_workbenches(); diff --git a/src/Gui/DockWindow.h b/src/Gui/DockWindow.h index 24f2b35806..08da4c8dc7 100644 --- a/src/Gui/DockWindow.h +++ b/src/Gui/DockWindow.h @@ -53,7 +53,7 @@ public: * the view will attach to the active document. Be aware there isn't * always an active document available! */ - DockWindow ( Gui::Document* pcDocument=0, QWidget *parent=0 ); + DockWindow ( Gui::Document* pcDocument=nullptr, QWidget *parent=nullptr ); /** View destructor * Detach the view from the document, if attached. */ diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 9b075f5137..5e40d7b5cc 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -98,11 +98,11 @@ struct DockWindowManagerP }; } // namespace Gui -DockWindowManager* DockWindowManager::_instance = 0; +DockWindowManager* DockWindowManager::_instance = nullptr; DockWindowManager* DockWindowManager::instance() { - if ( _instance == 0 ) + if ( _instance == nullptr ) _instance = new DockWindowManager; return _instance; } @@ -110,7 +110,7 @@ DockWindowManager* DockWindowManager::instance() void DockWindowManager::destruct() { delete _instance; - _instance = 0; + _instance = nullptr; } DockWindowManager::DockWindowManager() @@ -176,7 +176,7 @@ QWidget* DockWindowManager::getDockWindow(const char* name) const return (*it)->widget(); } - return 0; + return nullptr; } /** @@ -195,7 +195,7 @@ QList DockWindowManager::getDockWindows() const */ QWidget* DockWindowManager::removeDockWindow(const char* name) { - QWidget* widget=0; + QWidget* widget=nullptr; for (QList::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) { if ((*it)->objectName() == QLatin1String(name)) { QDockWidget* dw = *it; @@ -203,8 +203,8 @@ QWidget* DockWindowManager::removeDockWindow(const char* name) getMainWindow()->removeDockWidget(dw); // avoid to destruct the embedded widget widget = dw->widget(); - widget->setParent(0); - dw->setWidget(0); + widget->setParent(nullptr); + dw->setWidget(nullptr); disconnect(dw, SIGNAL(destroyed(QObject*)), this, SLOT(onDockWidgetDestroyed(QObject*))); disconnect(widget, SIGNAL(destroyed(QObject*)), @@ -229,8 +229,8 @@ void DockWindowManager::removeDockWindow(QWidget* widget) d->_dockedWindows.erase(it); getMainWindow()->removeDockWidget(dw); // avoid to destruct the embedded widget - widget->setParent(0); - dw->setWidget(0); + widget->setParent(nullptr); + dw->setWidget(nullptr); disconnect(dw, SIGNAL(destroyed(QObject*)), this, SLOT(onDockWidgetDestroyed(QObject*))); disconnect(widget, SIGNAL(destroyed(QObject*)), @@ -306,7 +306,7 @@ bool DockWindowManager::registerDockWindow(const char* name, QWidget* widget) QWidget* DockWindowManager::unregisterDockWindow(const char* name) { - QWidget* widget = 0; + QWidget* widget = nullptr; QMap >::Iterator it = d->_dockWindows.find(QLatin1String(name)); if (it != d->_dockWindows.end()) { widget = d->_dockWindows.take(QLatin1String(name)); @@ -429,7 +429,7 @@ QDockWidget* DockWindowManager::findDockWidget(const QList& dw, co return *it; } - return 0; + return nullptr; } void DockWindowManager::onDockWidgetDestroyed(QObject* dw) diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 8fa372d72b..4c08af803e 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -149,10 +149,10 @@ Document::Document(App::Document* pcDocument,Application * app) d->_isTransacting = false; d->_pcAppWnd = app; d->_pcDocument = pcDocument; - d->_editViewProvider = 0; - d->_editingObject = 0; - d->_editViewProviderParent = 0; - d->_editingViewer = 0; + d->_editViewProvider = nullptr; + d->_editingObject = nullptr; + d->_editViewProviderParent = nullptr; + d->_editingViewer = nullptr; d->_editMode = 0; // Setup the connections @@ -298,7 +298,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname) // No subname reference is given, we try to extract one from the current // selection in order to obtain the correct transformation matrix below auto sels = Gui::Selection().getCompleteSelection(false); - App::DocumentObject *parentObj = 0; + App::DocumentObject *parentObj = nullptr; for(auto &sel : sels) { if(!sel.pObject || !sel.pObject->getNameInDocument()) continue; @@ -306,13 +306,13 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname) parentObj = sel.pObject; else if(parentObj!=sel.pObject) { FC_LOG("Cannot deduce subname for editing, more than one parent?"); - parentObj = 0; + parentObj = nullptr; break; } auto sobj = parentObj->getSubObject(sel.SubName); if(!sobj || (sobj!=obj && sobj->getLinkedObject(true)!= obj)) { FC_LOG("Cannot deduce subname for editing, subname mismatch"); - parentObj = 0; + parentObj = nullptr; break; } _subname = sel.SubName; @@ -368,7 +368,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname) // d->_editingTransform = ext->globalGroupPlacement().toMatrix(); // } // } - auto sobj = obj->getSubObject(subname,0,&d->_editingTransform); + auto sobj = obj->getSubObject(subname,nullptr,&d->_editingTransform); if(!sobj || !sobj->getNameInDocument()) { FC_ERR("Invalid sub object '" << obj->getFullName() << '.' << (subname?subname:"") << "'"); @@ -415,9 +415,9 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname) d->_editMode = ModNum; d->_editViewProvider = svp->startEditing(ModNum); if(!d->_editViewProvider) { - d->_editViewProviderParent = 0; + d->_editViewProviderParent = nullptr; d->_editObjs.clear(); - d->_editingObject = 0; + d->_editingObject = nullptr; FC_LOG("object '" << sobj->getFullName() << "' refuse to edit"); return false; } @@ -451,7 +451,7 @@ void Document::setEditingTransform(const Base::Matrix4D &mat) { } void Document::resetEdit(void) { - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); } void Document::_resetEdit(void) @@ -474,7 +474,7 @@ void Document::_resetEdit(void) auto vpd = static_cast(d->_editViewProvider); vpd->getDocument()->signalResetEdit(*vpd); } - d->_editViewProvider = 0; + d->_editViewProvider = nullptr; // The logic below is not necessary anymore, because this method is // changed into a private one, _resetEdit(). And the exposed @@ -493,12 +493,12 @@ void Document::_resetEdit(void) #endif App::GetApplication().closeActiveTransaction(); } - d->_editViewProviderParent = 0; - d->_editingViewer = 0; + d->_editViewProviderParent = nullptr; + d->_editingViewer = nullptr; d->_editObjs.clear(); - d->_editingObject = 0; + d->_editingObject = nullptr; if(Application::Instance->editDocument() == this) - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); } ViewProvider *Document::getInEdit(ViewProviderDocumentObject **parentVp, @@ -516,7 +516,7 @@ ViewProvider *Document::getInEdit(ViewProviderDocumentObject **parentVp, return d->_editViewProvider; } - return 0; + return nullptr; } void Document::setInEdit(ViewProviderDocumentObject *parentVp, const char *subname) { @@ -607,7 +607,7 @@ ViewProvider *Document::getViewProviderByName(const char* name) const return it2->second; } - return 0; + return nullptr; } bool Document::isShow(const char* name) @@ -671,7 +671,7 @@ void Document::slotNewObject(const App::DocumentObject& Obj) } else if (cName!=Obj.getViewProviderName() && !pcProvider->allowOverride(Obj)) { FC_WARN("View provider type '" << cName << "' does not support " << Obj.getFullName()); delete base; - pcProvider = 0; + pcProvider = nullptr; cName = Obj.getViewProviderName(); } else break; @@ -745,7 +745,7 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) auto editDoc = Application::Instance->editDocument(); if(editDoc->d->_editViewProvider==viewProvider || editDoc->d->_editViewProviderParent==viewProvider) - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); } handleChildren3D(viewProvider,true); @@ -778,7 +778,7 @@ void Document::beforeDelete() { (vp && vp->getDocument()==this) || (vpp && vpp->getDocument()==this)) { - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); } } for(auto &v : d->_ViewProviderMap) @@ -802,7 +802,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop { Base::Matrix4D mat; auto sobj = d->_editViewProviderParent->getObject()->getSubObject( - d->_editSubname.c_str(),0,&mat); + d->_editSubname.c_str(),nullptr,&mat); if(sobj == d->_editingObject && d->_editingTransform!=mat) { d->_editingTransform = mat; d->_editingViewer->setEditingTransform(d->_editingTransform); @@ -921,7 +921,7 @@ void Document::slotSkipRecompute(const App::Document& doc, const std::vectoreditDocument(); if(editDoc) { auto vp = dynamic_cast(editDoc->getInEdit()); @@ -987,7 +987,7 @@ ViewProviderDocumentObject* Document::getViewProviderByPathFromTail(SoPath * pat } } - return 0; + return nullptr; } ViewProviderDocumentObject* Document::getViewProviderByPathFromHead(SoPath * path) const @@ -1001,16 +1001,16 @@ ViewProviderDocumentObject* Document::getViewProviderByPathFromHead(SoPath * pat } } - return 0; + return nullptr; } ViewProviderDocumentObject *Document::getViewProvider(SoNode *node) const { if(!node || !node->isOfType(SoSeparator::getClassTypeId())) - return 0; + return nullptr; auto it = d->_CoinMap.find(static_cast(node)); if(it!=d->_CoinMap.end()) return it->second; - return 0; + return nullptr; } std::vector > Document::getViewProvidersByPath(SoPath * path) const @@ -1443,7 +1443,7 @@ void Document::RestoreDocFile(Base::Reader &reader) if(ppReturn && ppReturn[0]) { saveCameraSettings(ppReturn); try { - const char** pReturnIgnore=0; + const char** pReturnIgnore=nullptr; std::list mdi = getMDIViews(); for (std::list::iterator it = mdi.begin(); it != mdi.end(); ++it) { if ((*it)->onHasMsg("SetCamera")) @@ -1565,7 +1565,7 @@ void Document::SaveDocFile (Base::Writer &writer) const std::list mdi = getMDIViews(); for (std::list::iterator it = mdi.begin(); it != mdi.end(); ++it) { if ((*it)->onHasMsg("GetCamera")) { - const char* ppReturn=0; + const char* ppReturn=nullptr; (*it)->onMsg("GetCamera",&ppReturn); if(saveCameraSettings(ppReturn)) break; @@ -1726,18 +1726,18 @@ void Document::addRootObjectsToGroup(const std::vector& ob MDIView *Document::createView(const Base::Type& typeId) { if (!typeId.isDerivedFrom(MDIView::getClassTypeId())) - return 0; + return nullptr; std::list theViews = this->getMDIViewsOfType(typeId); if (typeId == View3DInventor::getClassTypeId()) { - QtGLWidget* shareWidget = 0; + QtGLWidget* shareWidget = nullptr; // VBO rendering doesn't work correctly when we don't share the OpenGL widgets if (!theViews.empty()) { View3DInventor* firstView = static_cast(theViews.front()); shareWidget = qobject_cast(firstView->getViewer()->getGLWidget()); - const char *ppReturn = 0; + const char *ppReturn = nullptr; firstView->onMsg("GetCamera",&ppReturn); saveCameraSettings(ppReturn); } @@ -1780,20 +1780,20 @@ MDIView *Document::createView(const Base::Type& typeId) view3D->getViewer()->redraw(); if (!cameraSettings.empty()) { - const char *ppReturn = 0; + const char *ppReturn = nullptr; view3D->onMsg(cameraSettings.c_str(),&ppReturn); } getMainWindow()->addWindow(view3D); return view3D; } - return 0; + return nullptr; } Gui::MDIView* Document::cloneView(Gui::MDIView* oldview) { if (!oldview) - return 0; + return nullptr; if (oldview->getTypeId() == View3DInventor::getClassTypeId()) { View3DInventor* view3D = new View3DInventor(this, getMainWindow()); @@ -1839,7 +1839,7 @@ Gui::MDIView* Document::cloneView(Gui::MDIView* oldview) return view3D; } - return 0; + return nullptr; } const char *Document::getCameraSettings() const { @@ -1895,7 +1895,7 @@ void Document::detachView(Gui::BaseView* pcView, bool bPassiv) // decouple a passive view std::list::iterator it = d->passiveViews.begin(); while (it != d->passiveViews.end()) { - (*it)->setDocument(0); + (*it)->setDocument(nullptr); it = d->passiveViews.begin(); } @@ -2064,7 +2064,7 @@ std::list Document::getMDIViewsOfType(const Base::Type& typeId) const bool Document::sendMsgToViews(const char* pMsg) { std::list::iterator it; - const char** pReturnIgnore=0; + const char** pReturnIgnore=nullptr; for (it = d->baseViews.begin();it != d->baseViews.end();++it) { if ((*it)->onMsg(pMsg,pReturnIgnore)) { @@ -2132,7 +2132,7 @@ MDIView* Document::getActiveView(void) const if(windows.contains(*rit) || (*rit)->isDerivedFrom(View3DInventor::getClassTypeId())) return *rit; } - return 0; + return nullptr; } MDIView *Document::setActiveView(ViewProviderDocumentObject *vp, Base::Type typeId) @@ -2227,7 +2227,7 @@ Gui::MDIView* Document::getViewOfNode(SoNode* node) const return *it; } - return 0; + return nullptr; } Gui::MDIView* Document::getViewOfViewProvider(Gui::ViewProvider* vp) const @@ -2246,7 +2246,7 @@ Gui::MDIView* Document::getEditingViewOfViewProvider(Gui::ViewProvider* vp) cons return *it; } - return 0; + return nullptr; } //-------------------------------------------------------------------------- diff --git a/src/Gui/Document.h b/src/Gui/Document.h index 6bf167787c..585ab65a80 100644 --- a/src/Gui/Document.h +++ b/src/Gui/Document.h @@ -216,7 +216,7 @@ public: std::list getMDIViewsOfType(const Base::Type& typeId) const; //@} - MDIView *setActiveView(ViewProviderDocumentObject *vp=0, Base::Type typeId = Base::Type()); + MDIView *setActiveView(ViewProviderDocumentObject *vp=nullptr, Base::Type typeId = Base::Type()); /** @name View provider handling */ //@{ @@ -240,7 +240,7 @@ public: std::vector getViewProvidersOfType(const Base::Type& typeId) const; ViewProvider *getViewProviderByName(const char* name) const; /// set the ViewProvider in special edit mode - bool setEdit(Gui::ViewProvider* p, int ModNum=0, const char *subname=0); + bool setEdit(Gui::ViewProvider* p, int ModNum=0, const char *subname=nullptr); const Base::Matrix4D &getEditingTransform() const; void setEditingTransform(const Base::Matrix4D &mat); /// reset from edit mode, this cause all document to reset edit @@ -248,8 +248,8 @@ public: /// reset edit of this document void _resetEdit(void); /// get the in edit ViewProvider or NULL - ViewProvider *getInEdit(ViewProviderDocumentObject **parentVp=0, - std::string *subname=0, int *mode=0, std::string *subElement=0) const; + ViewProvider *getInEdit(ViewProviderDocumentObject **parentVp=nullptr, + std::string *subname=nullptr, int *mode=nullptr, std::string *subElement=nullptr) const; /// set the in edit ViewProvider subname reference void setInEdit(ViewProviderDocumentObject *parentVp, const char *subname); /** Add or remove view provider from scene graphs of all views @@ -263,7 +263,7 @@ public: /** @name methods for the UNDO REDO handling */ //@{ /// Open a new Undo transaction on the document - void openCommand(const char* sName=0); + void openCommand(const char* sName=nullptr); /// Commit the Undo transaction on the document void commitCommand(void); /// Abort the Undo transaction on the document diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index 2961d4f3c0..e49e24c29a 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -103,7 +103,7 @@ namespace Gui { { qDeleteAll(childItems); childItems.clear(); } protected: - DocumentModelIndex() : parentItem(0) {} + DocumentModelIndex() : parentItem(nullptr) {} DocumentModelIndex *parentItem; QList childItems; }; @@ -204,7 +204,7 @@ namespace Gui { // ------------------------------------------------------------------------ - QIcon* DocumentIndex::documentIcon = 0; + QIcon* DocumentIndex::documentIcon = nullptr; void DocumentIndex::addToDocument(ViewProviderIndex* vp) { @@ -374,7 +374,7 @@ DocumentModel::DocumentModel(QObject* parent) DocumentModel::~DocumentModel() { - delete d; d = 0; + delete d; d = nullptr; } void DocumentModel::slotNewDocument(const Gui::Document& Doc) @@ -562,15 +562,15 @@ void DocumentModel::slotActiveObject(const Gui::ViewProviderDocumentObject& obj) const Document* DocumentModel::getDocument(const QModelIndex& index) const { if (!index.isValid()) - return 0; - Base::BaseClass* item = 0; + return nullptr; + Base::BaseClass* item = nullptr; item = static_cast(index.internalPointer()); if (item->getTypeId() == DocumentIndex::getClassTypeId()) { const Gui::Document& d = static_cast(item)->d; return (&d); } - return 0; + return nullptr; } bool DocumentModel::isPropertyLink(const App::Property& prop) const @@ -631,7 +631,7 @@ Qt::ItemFlags DocumentModel::flags(const QModelIndex &index) const QModelIndex DocumentModel::index (int row, int column, const QModelIndex & parent) const { - DocumentModelIndex* item = 0; + DocumentModelIndex* item = nullptr; if (!parent.isValid()) item = d->rootItem; else @@ -645,7 +645,7 @@ QModelIndex DocumentModel::parent (const QModelIndex & index) const { if (!index.isValid() || index.internalPointer() == d->rootItem) return QModelIndex(); - DocumentModelIndex* item = 0; + DocumentModelIndex* item = nullptr; item = static_cast(index.internalPointer()); DocumentModelIndex* parent = item->parent(); return createIndex(parent->row(), 0, parent); @@ -655,7 +655,7 @@ int DocumentModel::rowCount (const QModelIndex & parent) const { if (!parent.isValid()) return 1; // the root item - DocumentModelIndex* item = 0; + DocumentModelIndex* item = nullptr; item = static_cast(parent.internalPointer()); return item->childCount(); } diff --git a/src/Gui/DocumentObserver.cpp b/src/Gui/DocumentObserver.cpp index d50cf453fb..c53e22331d 100644 --- a/src/Gui/DocumentObserver.cpp +++ b/src/Gui/DocumentObserver.cpp @@ -204,7 +204,7 @@ std::string ViewProviderT::getAppDocumentPython() const ViewProviderDocumentObject* ViewProviderT::getViewProvider() const { - ViewProviderDocumentObject* obj = 0; + ViewProviderDocumentObject* obj = nullptr; Document* doc = getDocument(); if (doc) { obj = dynamic_cast(doc->getViewProviderByName(object.c_str())); diff --git a/src/Gui/DocumentObserverPython.cpp b/src/Gui/DocumentObserverPython.cpp index 2a55d9166c..0ad4c7824b 100644 --- a/src/Gui/DocumentObserverPython.cpp +++ b/src/Gui/DocumentObserverPython.cpp @@ -43,7 +43,7 @@ void DocumentObserverPython::addObserver(const Py::Object& obj) void DocumentObserverPython::removeObserver(const Py::Object& obj) { - DocumentObserverPython* obs=0; + DocumentObserverPython* obs=nullptr; for (std::vector::iterator it = _instances.begin(); it != _instances.end(); ++it) { if ((*it)->inst == obj) { diff --git a/src/Gui/DocumentPyImp.cpp b/src/Gui/DocumentPyImp.cpp index 3f619f71eb..0f94e6fb32 100644 --- a/src/Gui/DocumentPyImp.cpp +++ b/src/Gui/DocumentPyImp.cpp @@ -465,7 +465,7 @@ void DocumentPy::setInEditInfo(Py::Object arg) Py::Int DocumentPy::getEditMode(void) const { int mode = -1; - getDocumentPtr()->getInEdit(0,0,&mode); + getDocumentPtr()->getInEdit(nullptr,nullptr,&mode); return Py::Int(mode); } diff --git a/src/Gui/DocumentRecovery.h b/src/Gui/DocumentRecovery.h index 2adad23c4e..c8183beff6 100644 --- a/src/Gui/DocumentRecovery.h +++ b/src/Gui/DocumentRecovery.h @@ -43,7 +43,7 @@ class DocumentRecovery : public QDialog Q_OBJECT public: - DocumentRecovery(const QList&, QWidget* parent = 0); + DocumentRecovery(const QList&, QWidget* parent = nullptr); virtual ~DocumentRecovery(); void accept(); diff --git a/src/Gui/DownloadItem.h b/src/Gui/DownloadItem.h index 8a40514ec7..8b533f11b1 100644 --- a/src/Gui/DownloadItem.h +++ b/src/Gui/DownloadItem.h @@ -42,7 +42,7 @@ class EditTableView : public QTableView Q_OBJECT public: - EditTableView(QWidget *parent = 0); + EditTableView(QWidget *parent = nullptr); void keyPressEvent(QKeyEvent *event); public Q_SLOTS: @@ -55,7 +55,7 @@ class SqueezeLabel : public QLabel Q_OBJECT public: - SqueezeLabel(QWidget *parent = 0); + SqueezeLabel(QWidget *parent = nullptr); protected: void paintEvent(QPaintEvent *event); @@ -93,7 +93,7 @@ class NetworkAccessManager : public QNetworkAccessManager Q_OBJECT public: - NetworkAccessManager(QObject *parent = 0); + NetworkAccessManager(QObject *parent = nullptr); private Q_SLOTS: void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); @@ -114,7 +114,7 @@ Q_SIGNALS: void statusChanged(); public: - DownloadItem(QNetworkReply *reply = 0, bool requestFileName = false, QWidget *parent = 0); + DownloadItem(QNetworkReply *reply = nullptr, bool requestFileName = false, QWidget *parent = nullptr); bool downloading() const; bool downloadedSuccessfully() const; diff --git a/src/Gui/DownloadManager.cpp b/src/Gui/DownloadManager.cpp index 06658d1318..05ed7b4064 100644 --- a/src/Gui/DownloadManager.cpp +++ b/src/Gui/DownloadManager.cpp @@ -45,7 +45,7 @@ using namespace Gui::Dialog; /* TRANSLATOR Gui::Dialog::DownloadManager */ -DownloadManager* DownloadManager::self = 0; +DownloadManager* DownloadManager::self = nullptr; DownloadManager* DownloadManager::getInstance() { @@ -58,7 +58,7 @@ DownloadManager::DownloadManager(QWidget *parent) : QDialog(parent) , m_autoSaver(new AutoSaver(this)) , m_manager(new NetworkAccessManager(this)) - , m_iconProvider(0) + , m_iconProvider(nullptr) , m_removePolicy(Never) , ui(new Ui_DownloadManager()) { @@ -90,7 +90,7 @@ DownloadManager::~DownloadManager() if (m_iconProvider) delete m_iconProvider; delete ui; - self = 0; + self = nullptr; } void DownloadManager::closeEvent(QCloseEvent* e) @@ -264,7 +264,7 @@ void DownloadManager::load() QString fileName = settings.value(key + QLatin1String("location")).toString(); bool done = settings.value(key + QLatin1String("done"), true).toBool(); if (!url.isEmpty() && !fileName.isEmpty()) { - DownloadItem *item = new DownloadItem(0, false, this); + DownloadItem *item = new DownloadItem(nullptr, false, this); item->m_output.setFileName(fileName); item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName()); item->m_url = url; @@ -288,7 +288,7 @@ void DownloadManager::cleanup() updateItemCount(); if (m_downloads.isEmpty() && m_iconProvider) { delete m_iconProvider; - m_iconProvider = 0; + m_iconProvider = nullptr; } m_autoSaver->changeOccurred(); } diff --git a/src/Gui/DownloadManager.h b/src/Gui/DownloadManager.h index 8a7af7d4c6..f306051d75 100644 --- a/src/Gui/DownloadManager.h +++ b/src/Gui/DownloadManager.h @@ -56,7 +56,7 @@ public: static DownloadManager* getInstance(); private: - DownloadManager(QWidget *parent = 0); + DownloadManager(QWidget *parent = nullptr); ~DownloadManager(); public: @@ -104,7 +104,7 @@ class DownloadModel : public QAbstractListModel Q_OBJECT public: - DownloadModel(DownloadManager *downloadManager, QObject *parent = 0); + DownloadModel(DownloadManager *downloadManager, QObject *parent = nullptr); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 1cd537529a..c805fbbaf2 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -85,7 +85,7 @@ TYPESYSTEM_SOURCE_ABSTRACT(Gui::EditorView, Gui::MDIView) * name 'name'. */ EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent) - : MDIView(0,parent,Qt::WindowFlags()), WindowParameter( "Editor" ) + : MDIView(nullptr,parent,Qt::WindowFlags()), WindowParameter( "Editor" ) { d = new EditorViewP; d->lock = false; @@ -636,7 +636,7 @@ void PythonEditorView::executeScript() { // always save the macro when it is modified if (EditorView::onHasMsg("Save")) - EditorView::onMsg("Save", 0); + EditorView::onMsg("Save", nullptr); try { Application::Instance->macroManager()->run(Gui::MacroManager::File,fileName().toUtf8()); } diff --git a/src/Gui/ExpressionBinding.cpp b/src/Gui/ExpressionBinding.cpp index 619cf45496..4f4cbb3d74 100644 --- a/src/Gui/ExpressionBinding.cpp +++ b/src/Gui/ExpressionBinding.cpp @@ -47,7 +47,7 @@ using namespace App; namespace bp = boost::placeholders; ExpressionBinding::ExpressionBinding() - : iconLabel(0) + : iconLabel(nullptr) , iconHeight(-1) , m_autoApply(false) { @@ -60,7 +60,7 @@ ExpressionBinding::~ExpressionBinding() bool ExpressionBinding::isBound() const { - return path.getDocumentObject() != 0; + return path.getDocumentObject() != nullptr; } void ExpressionBinding::unbind() @@ -105,7 +105,7 @@ void ExpressionBinding::bind(const App::ObjectIdentifier &_path) { const Property * prop = _path.getProperty(); - Q_ASSERT(prop != 0); + Q_ASSERT(prop != nullptr); path = prop->canonicalPath(_path); @@ -125,14 +125,14 @@ void ExpressionBinding::bind(const Property &prop) bool ExpressionBinding::hasExpression() const { - return isBound() && getExpression() != 0; + return isBound() && getExpression() != nullptr; } std::shared_ptr ExpressionBinding::getExpression() const { DocumentObject * docObj = path.getDocumentObject(); - Q_ASSERT(isBound() && docObj != 0); + Q_ASSERT(isBound() && docObj != nullptr); return docObj->getExpression(path).expression; } @@ -238,7 +238,7 @@ bool ExpressionBinding::apply() { Property * prop(path.getProperty()); - assert(prop != 0); + assert(prop != nullptr); Q_UNUSED(prop); DocumentObject * docObj(path.getDocumentObject()); diff --git a/src/Gui/ExpressionCompleter.cpp b/src/Gui/ExpressionCompleter.cpp index c00c4b6823..6b46121597 100644 --- a/src/Gui/ExpressionCompleter.cpp +++ b/src/Gui/ExpressionCompleter.cpp @@ -143,7 +143,7 @@ public: return QVariant(); QVariant v; Info info = getInfo(index); - _data(info,index.row(),&v,0,role==Qt::UserRole); + _data(info,index.row(),&v,nullptr,role==Qt::UserRole); FC_TRACE(info.d.doc << "," << info.d.obj << "," << index.row() << ": " << v.toString().toUtf8().constData()); return v; @@ -157,8 +157,8 @@ public: int objSize = 0; int propSize = 0; std::vector > props; - App::Document *doc = 0; - App::DocumentObject *obj = 0; + App::Document *doc = nullptr; + App::DocumentObject *obj = nullptr; const char *propName = nullptr; if(idx>=0 && idxsetDocumentObject(currentDocObj, checkInList); return; } - if (currentDocObj != 0) { + if (currentDocObj != nullptr) { completer = new ExpressionCompleter(currentDocObj, this, noProperty, checkInList); completer->setWidget(this); completer->setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/Gui/ExpressionCompleter.h b/src/Gui/ExpressionCompleter.h index 04e04da4a4..deae91f554 100644 --- a/src/Gui/ExpressionCompleter.h +++ b/src/Gui/ExpressionCompleter.h @@ -83,7 +83,7 @@ private: class GuiExport ExpressionLineEdit : public QLineEdit { Q_OBJECT public: - ExpressionLineEdit(QWidget *parent = 0, bool noProperty=false, + ExpressionLineEdit(QWidget *parent = nullptr, bool noProperty=false, char checkPrefix=0, bool checkInList=true); void setDocumentObject(const App::DocumentObject *currentDocObj, bool checkInList=true); void setPrefix(char prefix); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index d6725671fc..44a82a4b72 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -718,9 +718,9 @@ void FileChooser::chooseFile() QString fn; if ( mode() == File ) { if (acceptMode() == AcceptOpen) - fn = QFileDialog::getOpenFileName(this, tr( "Select a file" ), prechosenDirectory, _filter, 0, dlgOpt); + fn = QFileDialog::getOpenFileName(this, tr( "Select a file" ), prechosenDirectory, _filter, nullptr, dlgOpt); else - fn = QFileDialog::getSaveFileName(this, tr( "Select a file" ), prechosenDirectory, _filter, 0, dlgOpt); + fn = QFileDialog::getSaveFileName(this, tr( "Select a file" ), prechosenDirectory, _filter, nullptr, dlgOpt); } else { QFileDialog::Options option = QFileDialog::ShowDirsOnly | dlgOpt; fn = QFileDialog::getExistingDirectory( this, tr( "Select a directory" ), prechosenDirectory,option ); diff --git a/src/Gui/FileDialog.h b/src/Gui/FileDialog.h index 66fa256986..1a9e5c3bfb 100644 --- a/src/Gui/FileDialog.h +++ b/src/Gui/FileDialog.h @@ -60,14 +60,14 @@ class GuiExport FileDialog : public QFileDialog Q_OBJECT public: - static QString getOpenFileName( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), - const QString & filter = QString(), QString * selectedFilter = 0, Options options = Options() ); - static QString getSaveFileName( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), - const QString & filter = QString(), QString * selectedFilter = 0, Options options = Options() ); - static QString getExistingDirectory( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), + static QString getOpenFileName( QWidget * parent = nullptr, const QString & caption = QString(), const QString & dir = QString(), + const QString & filter = QString(), QString * selectedFilter = nullptr, Options options = Options() ); + static QString getSaveFileName( QWidget * parent = nullptr, const QString & caption = QString(), const QString & dir = QString(), + const QString & filter = QString(), QString * selectedFilter = nullptr, Options options = Options() ); + static QString getExistingDirectory( QWidget * parent = nullptr, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly ); - static QStringList getOpenFileNames( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), - const QString & filter = QString(), QString * selectedFilter = 0, Options options = Options() ); + static QStringList getOpenFileNames( QWidget * parent = nullptr, const QString & caption = QString(), const QString & dir = QString(), + const QString & filter = QString(), QString * selectedFilter = nullptr, Options options = Options() ); /*! Return the last directory a file was read from or saved to. */ static QString getWorkingDirectory(); @@ -76,7 +76,7 @@ public: static QString restoreLocation(); static void saveLocation(const QString&); - FileDialog(QWidget * parent = 0); + FileDialog(QWidget * parent = nullptr); ~FileDialog(); void accept(); @@ -164,7 +164,7 @@ public: enum Mode { File, Directory }; enum AcceptMode { AcceptOpen, AcceptSave }; - FileChooser ( QWidget * parent = 0 ); + FileChooser ( QWidget * parent = nullptr ); virtual ~FileChooser(); /** diff --git a/src/Gui/Flag.cpp b/src/Gui/Flag.cpp index 6cefc45435..34713a4a25 100644 --- a/src/Gui/Flag.cpp +++ b/src/Gui/Flag.cpp @@ -230,7 +230,7 @@ QLayoutItem *FlagLayout::itemAt(int index) const if (wrapper) return wrapper->item; else - return 0; + return nullptr; } QSize FlagLayout::minimumSize() const @@ -298,7 +298,7 @@ QLayoutItem *FlagLayout::takeAt(int index) ItemWrapper *layoutStruct = list.takeAt(index); return layoutStruct->item; } - return 0; + return nullptr; } void FlagLayout::add(QLayoutItem *item, Position position) @@ -328,7 +328,7 @@ QSize FlagLayout::calculateSize(SizeType sizeType) const TYPESYSTEM_SOURCE_ABSTRACT(Gui::GLFlagWindow, Gui::GLGraphicsItem) -GLFlagWindow::GLFlagWindow(View3DInventorViewer* view) : _viewer(view), _flagLayout(0) +GLFlagWindow::GLFlagWindow(View3DInventorViewer* view) : _viewer(view), _flagLayout(nullptr) { } @@ -382,7 +382,7 @@ Flag* GLFlagWindow::getFlag(int index) const QWidget* flag = _flagLayout->itemAt(index)->widget(); return qobject_cast(flag); } - return 0; + return nullptr; } int GLFlagWindow::countFlags() const diff --git a/src/Gui/Flag.h b/src/Gui/Flag.h index 3b8f42a6d9..2767cf5781 100644 --- a/src/Gui/Flag.h +++ b/src/Gui/Flag.h @@ -42,7 +42,7 @@ class GuiExport Flag : public QtGLWidget Q_OBJECT public: - Flag(QWidget* parent=0); + Flag(QWidget* parent=nullptr); ~Flag(); QSize sizeHint() const; diff --git a/src/Gui/GLBuffer.cpp b/src/Gui/GLBuffer.cpp index dc6b9d617a..11c72c36b3 100644 --- a/src/Gui/GLBuffer.cpp +++ b/src/Gui/GLBuffer.cpp @@ -55,7 +55,7 @@ OpenGLBuffer::OpenGLBuffer(GLenum type) , bufferId(0) , context(-1) , currentContext(-1) - , glue(0) + , glue(nullptr) { SoContextHandler::addContextDestructionCallback(context_destruction_cb, this); } @@ -191,9 +191,9 @@ void OpenGLBuffer::buffer_delete(void * closure, uint32_t contextid) OpenGLMultiBuffer::OpenGLMultiBuffer(GLenum type) : target(type) - , currentBuf(0) + , currentBuf(nullptr) , currentContext(-1) - , glue(0) + , glue(nullptr) { SoContextHandler::addContextDestructionCallback(context_destruction_cb, this); } @@ -245,7 +245,7 @@ void OpenGLMultiBuffer::destroy() } bufs.clear(); - currentBuf = 0; + currentBuf = nullptr; } void OpenGLMultiBuffer::allocate(const void *data, int count) @@ -296,7 +296,7 @@ void OpenGLMultiBuffer::context_destruction_cb(uint32_t context, void * userdata GLuint buffer = it->second; cc_glglue_glDeleteBuffers(glue, 1, &buffer); if (self->currentBuf == &it->second) - self->currentBuf = 0; + self->currentBuf = nullptr; self->bufs.erase(it); } } diff --git a/src/Gui/GLPainter.cpp b/src/Gui/GLPainter.cpp index ee4171e167..ad5a786999 100644 --- a/src/Gui/GLPainter.cpp +++ b/src/Gui/GLPainter.cpp @@ -34,7 +34,7 @@ using namespace Gui; TYPESYSTEM_SOURCE_ABSTRACT(Gui::GLGraphicsItem, Base::BaseClass) GLPainter::GLPainter() - : viewer(0) + : viewer(nullptr) , width(0) , height(0) , logicOp(false) @@ -118,13 +118,13 @@ bool GLPainter::end() glPopAttrib(); glPopMatrix(); - viewer = 0; + viewer = nullptr; return true; } bool GLPainter::isActive() const { - return viewer != 0; + return viewer != nullptr; } void GLPainter::setLineWidth(float w) @@ -222,7 +222,7 @@ Rubberband::Rubberband(View3DInventorViewer* v) : viewer(v) rgb_a = 1.0f; } -Rubberband::Rubberband() : viewer(0) +Rubberband::Rubberband() : viewer(nullptr) { x_old = y_old = x_new = y_new = 0; working = false; @@ -326,7 +326,7 @@ Polyline::Polyline(View3DInventorViewer* v) : viewer(v) rgb_a = 1.0f; } -Polyline::Polyline() : viewer(0) +Polyline::Polyline() : viewer(nullptr) { x_new = y_new = 0; working = false; diff --git a/src/Gui/GraphvizView.cpp b/src/Gui/GraphvizView.cpp index 994182b21a..d75903646d 100644 --- a/src/Gui/GraphvizView.cpp +++ b/src/Gui/GraphvizView.cpp @@ -64,7 +64,7 @@ namespace Gui { class GraphvizWorker : public QThread { Q_OBJECT public: - GraphvizWorker(QObject * parent = 0) + GraphvizWorker(QObject * parent = nullptr) : QThread(parent) { } @@ -226,7 +226,7 @@ void GraphvizGraphicsView::mouseReleaseEvent(QMouseEvent* e) /* TRANSLATOR Gui::GraphvizView */ GraphvizView::GraphvizView(App::Document & _doc, QWidget* parent) - : MDIView(0, parent) + : MDIView(nullptr, parent) , doc(_doc) , nPending(0) { diff --git a/src/Gui/GraphvizView.h b/src/Gui/GraphvizView.h index 804a84d91f..1e3ea5dd35 100644 --- a/src/Gui/GraphvizView.h +++ b/src/Gui/GraphvizView.h @@ -42,7 +42,7 @@ class GuiExport GraphvizView : public MDIView Q_OBJECT public: - GraphvizView(App::Document &_doc, QWidget* parent=0); + GraphvizView(App::Document &_doc, QWidget* parent=nullptr); ~GraphvizView(); QByteArray exportGraph(const QString& filter); diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index 57fdf5cf5a..7b177e61d0 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -168,7 +168,7 @@ public: Private(GUISingleApplication *q_ptr) : q_ptr(q_ptr) , timer(new QTimer(q_ptr)) - , server(0) + , server(nullptr) , running(false) { timer->setSingleShot(true); diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h index 2f49bd21f0..a07a42ecaf 100644 --- a/src/Gui/InputField.h +++ b/src/Gui/InputField.h @@ -74,7 +74,7 @@ class GuiExport InputField : public ExpressionLineEdit, public ExpressionBinding public: - InputField (QWidget * parent = 0); + InputField (QWidget * parent = nullptr); virtual ~InputField(); /// set the field with a quantity diff --git a/src/Gui/InputVector.h b/src/Gui/InputVector.h index 33800d9276..ddef82a6ab 100644 --- a/src/Gui/InputVector.h +++ b/src/Gui/InputVector.h @@ -42,7 +42,7 @@ class GuiExport LocationWidget : public QWidget Q_OBJECT public: - LocationWidget (QWidget * parent = 0); + LocationWidget (QWidget * parent = nullptr); virtual ~LocationWidget(); QSize sizeHint() const; @@ -50,7 +50,7 @@ public: void setPosition(const Base::Vector3d&); void setDirection(const Base::Vector3d& dir); Base::Vector3d getDirection() const; - Base::Vector3d getUserDirection(bool* ok=0) const; + Base::Vector3d getUserDirection(bool* ok=nullptr) const; private Q_SLOTS: void on_direction_activated(int); @@ -80,7 +80,7 @@ class GuiExport LocationDialog : public QDialog Q_OBJECT protected: - LocationDialog(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + LocationDialog(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); virtual ~LocationDialog(); protected: @@ -91,7 +91,7 @@ private Q_SLOTS: public: virtual Base::Vector3d getDirection() const = 0; - Base::Vector3d getUserDirection(bool* ok=0) const; + Base::Vector3d getUserDirection(bool* ok=nullptr) const; private: virtual void directionActivated(int) = 0; @@ -113,7 +113,7 @@ template class LocationDialogUi : public LocationDialog, public Ui { public: - LocationDialogUi(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()) : LocationDialog(parent, fl) + LocationDialogUi(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()) : LocationDialog(parent, fl) { this->setupUi(this); this->retranslate(); @@ -363,7 +363,7 @@ template class LocationDialogImp : public LocationDialog { public: - LocationDialogImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()) + LocationDialogImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()) : LocationDialog(parent, fl), ui(this) { } @@ -553,7 +553,7 @@ class GuiExport LocationDialogUiImp : public LocationDialog { public: template - LocationDialogUiImp(T* t, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()) + LocationDialogUiImp(T* t, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()) : LocationDialog(parent, fl), ui(new LocationImpUi(t)) { std::shared_ptr uit = boost::any_cast< std::shared_ptr >(ui->get()); diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index 98cbf06f5a..a415129e90 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -98,7 +98,7 @@ using namespace Gui; /* TRANSLATOR Gui::Translator */ -Translator* Translator::_pcSingleton = 0; +Translator* Translator::_pcSingleton = nullptr; namespace Gui { class TranslatorP @@ -123,7 +123,7 @@ void Translator::destruct (void) { if (_pcSingleton) delete _pcSingleton; - _pcSingleton=0; + _pcSingleton=nullptr; } Translator::Translator() diff --git a/src/Gui/LinkViewPyImp.cpp b/src/Gui/LinkViewPyImp.cpp index bc1b559175..c60f683069 100644 --- a/src/Gui/LinkViewPyImp.cpp +++ b/src/Gui/LinkViewPyImp.cpp @@ -53,12 +53,12 @@ std::string LinkViewPy::representation(void) const PyObject* LinkViewPy::reset(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; PY_TRY { auto lv = getLinkViewPtr(); lv->setSize(0); - lv->setLink(0); + lv->setLink(nullptr); Py_Return; } PY_CATCH; } @@ -66,12 +66,12 @@ PyObject* LinkViewPy::reset(PyObject *args) { PyObject* LinkViewPy::setMaterial(PyObject *args) { PyObject *pyObj; if (!PyArg_ParseTuple(args, "O", &pyObj)) - return 0; + return nullptr; PY_TRY { auto lv = getLinkViewPtr(); if(pyObj == Py_None) { - lv->setMaterial(-1,0); + lv->setMaterial(-1,nullptr); Py_Return; } if(PyObject_TypeCheck(pyObj,&App::MaterialPy::Type)) { @@ -85,10 +85,10 @@ PyObject* LinkViewPy::setMaterial(PyObject *args) { while(PyDict_Next(pyObj, &pos, &key, &value)) { Py::Int idx(key); if(value == Py_None) - materials[(int)idx] = 0; + materials[(int)idx] = nullptr; else if(!PyObject_TypeCheck(value,&App::MaterialPy::Type)) { PyErr_SetString(PyExc_TypeError, "exepcting a type of material"); - return 0; + return nullptr; }else materials[(int)idx] = static_cast(value)->getMaterialPtr(); } @@ -99,13 +99,13 @@ PyObject* LinkViewPy::setMaterial(PyObject *args) { if(PySequence_Check(pyObj)) { Py::Sequence seq(pyObj); std::vector materials; - materials.resize(seq.size(),0); + materials.resize(seq.size(),nullptr); for(Py_ssize_t i=0;i(item)->getMaterialPtr(); } @@ -115,14 +115,14 @@ PyObject* LinkViewPy::setMaterial(PyObject *args) { } PyErr_SetString(PyExc_TypeError, "exepcting a type of Material, [Material,...] or {Int:Material,}"); - return 0; + return nullptr; } PY_CATCH; } PyObject* LinkViewPy::setTransform(PyObject *args) { PyObject *pyObj; if (!PyArg_ParseTuple(args, "O", &pyObj)) - return 0; + return nullptr; PY_TRY { auto lv = getLinkViewPtr(); @@ -138,7 +138,7 @@ PyObject* LinkViewPy::setTransform(PyObject *args) { Py::Int idx(key); if(!PyObject_TypeCheck(value,&Base::MatrixPy::Type)) { PyErr_SetString(PyExc_TypeError, "exepcting a type of Matrix"); - return 0; + return nullptr; }else mat[(int)idx] = static_cast(value)->getMatrixPtr(); } @@ -149,12 +149,12 @@ PyObject* LinkViewPy::setTransform(PyObject *args) { if(PySequence_Check(pyObj)) { Py::Sequence seq(pyObj); std::vector mat; - mat.resize(seq.size(),0); + mat.resize(seq.size(),nullptr); for(Py_ssize_t i=0;i(item)->getMatrixPtr(); } @@ -164,7 +164,7 @@ PyObject* LinkViewPy::setTransform(PyObject *args) { } PyErr_SetString(PyExc_TypeError, "exepcting a type of Matrix, [Matrix,...] or {Int:Matrix,...}"); - return 0; + return nullptr; } PY_CATCH; } @@ -172,7 +172,7 @@ PyObject* LinkViewPy::setType(PyObject *args) { short type; PyObject *sublink = Py_True; if (!PyArg_ParseTuple(args, "h|O", &type,&sublink)) - return 0; + return nullptr; PY_TRY{ getLinkViewPtr()->setNodeType((LinkView::SnapshotType)type,PyObject_IsTrue(sublink)); @@ -185,7 +185,7 @@ PyObject* LinkViewPy::setChildren(PyObject *args) { PyObject *pyVis = Py_None; short type=0; if (!PyArg_ParseTuple(args, "O|Os",&pyObj,&pyVis,&type)) - return 0; + return nullptr; PY_TRY{ App::PropertyBoolList vis; @@ -204,11 +204,11 @@ PyObject* LinkViewPy::setLink(PyObject *args) PyObject *pyObj; PyObject *pySubName = Py_None; if (!PyArg_ParseTuple(args, "O|O",&pyObj,&pySubName)) - return 0; + return nullptr; PY_TRY { - ViewProviderDocumentObject *vpd = 0; - App::DocumentObject *obj = 0; + ViewProviderDocumentObject *vpd = nullptr; + App::DocumentObject *obj = nullptr; if(pyObj!=Py_None) { if(PyObject_TypeCheck(pyObj,&App::DocumentObjectPy::Type)) obj = static_cast(pyObj)->getDocumentObjectPtr(); @@ -217,7 +217,7 @@ PyObject* LinkViewPy::setLink(PyObject *args) else { PyErr_SetString(PyExc_TypeError, "exepcting a type of DocumentObject or ViewProviderDocumentObject"); - return 0; + return nullptr; } } @@ -241,7 +241,7 @@ Py::Object LinkViewPy::getOwner() const { } void LinkViewPy::setOwner(Py::Object owner) { - ViewProviderDocumentObject *vp = 0; + ViewProviderDocumentObject *vp = nullptr; if(!owner.isNone()) { if(!PyObject_TypeCheck(owner.ptr(),&ViewProviderDocumentObjectPy::Type)) throw Py::TypeError("exepcting the owner to be of ViewProviderDocumentObject"); @@ -273,8 +273,8 @@ PyObject* LinkViewPy::getElementPicked(PyObject* args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O",&obj)) - return NULL; - void *ptr = 0; + return nullptr; + void *ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoPickedPoint *", obj, &ptr, 0); SoPickedPoint *pp = reinterpret_cast(ptr); if(!pp) @@ -292,14 +292,14 @@ PyObject* LinkViewPy::getDetailPath(PyObject* args) const char *sub; PyObject *path; if (!PyArg_ParseTuple(args, "sO",&sub,&path)) - return NULL; - void *ptr = 0; + return nullptr; + void *ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoPath *", path, &ptr, 0); SoPath *pPath = reinterpret_cast(ptr); if(!pPath) throw Py::TypeError("type must be of coin.SoPath"); PY_TRY{ - SoDetail *det = 0; + SoDetail *det = nullptr; getLinkViewPtr()->linkGetDetailPath(sub,static_cast(pPath),det); if(!det) Py_Return; @@ -310,12 +310,12 @@ PyObject* LinkViewPy::getDetailPath(PyObject* args) PyObject* LinkViewPy::getBoundBox(PyObject* args) { PyObject *vobj = Py_None; if (!PyArg_ParseTuple(args, "O",&vobj)) - return 0; - ViewProviderDocumentObject *vpd = 0; + return nullptr; + ViewProviderDocumentObject *vpd = nullptr; if(vobj!=Py_None) { if(!PyObject_TypeCheck(vobj,&ViewProviderDocumentObjectPy::Type)) { PyErr_SetString(PyExc_TypeError, "exepcting a type of ViewProviderDocumentObject"); - return 0; + return nullptr; } vpd = static_cast(vobj)->getViewProviderDocumentObjectPtr(); } @@ -328,7 +328,7 @@ PyObject* LinkViewPy::getBoundBox(PyObject* args) { PyObject *LinkViewPy::getCustomAttributes(const char*) const { - return 0; + return nullptr; } int LinkViewPy::setCustomAttributes(const char*, PyObject*) @@ -372,7 +372,7 @@ void LinkViewPy::setVisibilities(Py::Object value) { PyObject* LinkViewPy::getChildren(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; auto children = getLinkViewPtr()->getChildren(); if(children.empty()) Py_Return; diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index b35f9f3ce6..5ab1bb096b 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -118,7 +118,7 @@ void MDIView::deleteSelf() // detach from document if (_pcDocument) onClose(); - _pcDocument = 0; + _pcDocument = nullptr; } PyObject* MDIView::getPyObject() @@ -363,7 +363,7 @@ void MDIView::setCurrentViewMode(ViewMode mode) if (qobject_cast(this->parentWidget())) getMainWindow()->removeWindow(this,false); setWindowFlags(windowFlags() | Qt::Window); - setParent(0, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | + setParent(nullptr, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); if (this->wstate & Qt::WindowMaximized) showMaximized(); @@ -393,7 +393,7 @@ void MDIView::setCurrentViewMode(ViewMode mode) if (qobject_cast(this->parentWidget())) getMainWindow()->removeWindow(this,false); setWindowFlags(windowFlags() | Qt::Window); - setParent(0, Qt::Window); + setParent(nullptr, Qt::Window); showFullScreen(); } else if (this->currentMode == TopLevel) { diff --git a/src/Gui/MDIView.h b/src/Gui/MDIView.h index 8ab7e6a5a4..f6a1e4d672 100644 --- a/src/Gui/MDIView.h +++ b/src/Gui/MDIView.h @@ -126,11 +126,11 @@ public: /// access getter for the active object list template - inline _T getActiveObject(const char* name, App::DocumentObject **parent=0, std::string *subname=0) const + inline _T getActiveObject(const char* name, App::DocumentObject **parent=nullptr, std::string *subname=nullptr) const { return ActiveObjects.getObject<_T>(name,parent,subname); } - void setActiveObject(App::DocumentObject*o, const char*n, const char *subname=0) + void setActiveObject(App::DocumentObject*o, const char*n, const char *subname=nullptr) { ActiveObjects.setObject(o, n, subname); } @@ -138,7 +138,7 @@ public: { return ActiveObjects.hasObject(n); } - bool isActiveObject(App::DocumentObject*o, const char*n, const char *subname=0) const + bool isActiveObject(App::DocumentObject*o, const char*n, const char *subname=nullptr) const { return ActiveObjects.hasObject(o,n,subname); } diff --git a/src/Gui/MDIViewPy.cpp b/src/Gui/MDIViewPy.cpp index f0f85e1132..a630a5a13a 100644 --- a/src/Gui/MDIViewPy.cpp +++ b/src/Gui/MDIViewPy.cpp @@ -164,7 +164,7 @@ Py::Object MDIViewPy::redoActions(const Py::Tuple& args) Py::Object MDIViewPy::sendMessage(const Py::Tuple& args) { - const char **ppReturn = 0; + const char **ppReturn = nullptr; char *psMsgStr; if (!PyArg_ParseTuple(args.ptr(), "s;Message string needed (string)",&psMsgStr)) throw Py::Exception(); @@ -234,13 +234,13 @@ Py::Object MDIViewPy::setActiveObject(const Py::Tuple& args) { PyObject* docObject = Py_None; char* name; - char *subname = 0; + char *subname = nullptr; if (!PyArg_ParseTuple(args.ptr(), "s|Os", &name, &docObject, &subname)) throw Py::Exception(); if (_view) { if (docObject == Py_None) { - _view->setActiveObject(0, name); + _view->setActiveObject(nullptr, name); } else { if (!PyObject_TypeCheck(docObject, &App::DocumentObjectPy::Type)) diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index 335537bfb3..fc44a2ccb6 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -50,7 +50,7 @@ MacroManager::MacroManager() guiAsComment(true), scriptToPyConsole(true), localEnv(true), - pyConsole(0), + pyConsole(nullptr), pyDebugger(new PythonDebugger()), totalLines(0) { @@ -235,7 +235,7 @@ namespace Gui { class PythonRedirector { public: - PythonRedirector(const char* type, PyObject* obj) : std_out(type), out(obj), old(0) + PythonRedirector(const char* type, PyObject* obj) : std_out(type), out(obj), old(nullptr) { if (out) { Base::PyGILStateLocker lock; @@ -265,8 +265,8 @@ void MacroManager::run(MacroType eType, const char *sName) try { ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("OutputWindow"); - PyObject* pyout = hGrp->GetBool("RedirectPythonOutput",true) ? new OutputStdout : 0; - PyObject* pyerr = hGrp->GetBool("RedirectPythonErrors",true) ? new OutputStderr : 0; + PyObject* pyout = hGrp->GetBool("RedirectPythonOutput",true) ? new OutputStdout : nullptr; + PyObject* pyerr = hGrp->GetBool("RedirectPythonErrors",true) ? new OutputStderr : nullptr; PythonRedirector std_out("stdout",pyout); PythonRedirector std_err("stderr",pyerr); //The given path name is expected to be Utf-8 diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 2778761f47..97b7e436b4 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -108,7 +108,7 @@ using namespace Gui::DockWnd; using namespace std; -MainWindow* MainWindow::instance = 0L; +MainWindow* MainWindow::instance = nullptr; namespace Gui { @@ -165,7 +165,7 @@ struct MainWindowP class MDITabbar : public QTabBar { public: - MDITabbar( QWidget * parent = 0 ) : QTabBar(parent) + MDITabbar( QWidget * parent = nullptr ) : QTabBar(parent) { menu = new QMenu(this); setDrawBase(false); @@ -252,8 +252,8 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) : QMainWindow( parent, f/*WDestructiveClose*/ ) { d = new MainWindowP; - d->splashscreen = 0; - d->activeView = 0; + d->splashscreen = nullptr; + d->activeView = nullptr; d->whatsthis = false; d->assistant = new Assistant(); @@ -359,7 +359,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) group->SetBool("Enabled", enabled); //ensure entry exists. if (enabled) { treeView = true; - TreeDockWidget* tree = new TreeDockWidget(0, this); + TreeDockWidget* tree = new TreeDockWidget(nullptr, this); tree->setObjectName (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Tree view"))); tree->setMinimumWidth(210); @@ -380,7 +380,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) group->SetBool("Enabled", enabled); //ensure entry exists. if (enabled) { propertyView = true; - PropertyDockView* pcPropView = new PropertyDockView(0, this); + PropertyDockView* pcPropView = new PropertyDockView(nullptr, this); pcPropView->setObjectName (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Property view"))); pcPropView->setMinimumWidth(210); @@ -390,7 +390,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) // Selection view if (hiddenDockWindows.find("Std_SelectionView") == std::string::npos) { - SelectionView* pcSelectionView = new SelectionView(0, this); + SelectionView* pcSelectionView = new SelectionView(nullptr, this); pcSelectionView->setObjectName (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Selection view"))); pcSelectionView->setMinimumWidth(210); @@ -406,7 +406,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) enable = group->GetBool("Enabled", true); } - ComboView* pcComboView = new ComboView(enable, 0, this); + ComboView* pcComboView = new ComboView(enable, nullptr, this); pcComboView->setObjectName(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Combo View"))); pcComboView->setMinimumWidth(150); pDockMgr->registerDockWindow("Std_ComboView", pcComboView); @@ -486,7 +486,7 @@ MainWindow::~MainWindow() { delete d->status; delete d; - instance = 0; + instance = nullptr; } MainWindow* MainWindow::getInstance() @@ -951,7 +951,7 @@ void MainWindow::removeWindow(Gui::MDIView* view, bool close) // auto subwindow = qobject_cast(parent); if(subwindow && d->mdiArea->subWindowList().contains(subwindow)) { - subwindow->setParent(0); + subwindow->setParent(nullptr); assert(!d->mdiArea->subWindowList().contains(subwindow)); // d->mdiArea->removeSubWindow(parent); @@ -1164,7 +1164,7 @@ void MainWindow::closeEvent (QCloseEvent * e) d->activityTimer->stop(); saveWindowSettings(); delete d->assistant; - d->assistant = 0; + d->assistant = nullptr; // See createMimeDataFromSelection QVariant prop = this->property("x-documentobject-file"); @@ -1345,12 +1345,12 @@ void MainWindow::switchToTopLevelMode() { QList dw = this->findChildren(); for (QList::Iterator it = dw.begin(); it != dw.end(); ++it) { - (*it)->setParent(0, Qt::Window); + (*it)->setParent(nullptr, Qt::Window); (*it)->show(); } QList mdi = getMainWindow()->windows(); for (QList::Iterator it = mdi.begin(); it != mdi.end(); ++it) { - (*it)->setParent(0, Qt::Window); + (*it)->setParent(nullptr, Qt::Window); (*it)->show(); } } @@ -1443,7 +1443,7 @@ void MainWindow::startSplasher(void) d->splashscreen->show(); } else - d->splashscreen = 0; + d->splashscreen = nullptr; } } @@ -1452,7 +1452,7 @@ void MainWindow::stopSplasher(void) if (d->splashscreen) { d->splashscreen->finish(this); delete d->splashscreen; - d->splashscreen = 0; + d->splashscreen = nullptr; } } @@ -1627,16 +1627,16 @@ QMimeData * MainWindow::createMimeDataFromSelection () const sel.push_back(s.pObject); } if(sel.empty()) - return 0; + return nullptr; auto all = App::Document::getDependencyList(sel); if (all.size() > sel.size()) { DlgObjectSelection dlg(sel,getMainWindow()); if(dlg.exec()!=QDialog::Accepted) - return 0; + return nullptr; sel = dlg.getSelections(); if(sel.empty()) - return 0; + return nullptr; } std::vector unsaved; @@ -1645,7 +1645,7 @@ QMimeData * MainWindow::createMimeDataFromSelection () const QMessageBox::critical(getMainWindow(), tr("Unsaved document"), tr("The exported object contains external link. Please save the document" "at least once before exporting.")); - return 0; + return nullptr; } unsigned int memsize=1000; // ~ for the meta-information @@ -1746,7 +1746,7 @@ void MainWindow::insertFromMimeData (const QMimeData * mimeData) doc->openTransaction("Paste"); Base::ByteArrayIStreambuf buf(res); - std::istream in(0); + std::istream in(nullptr); in.rdbuf(&buf); MergeDocuments mimeView(doc); std::vector newObj = mimeView.importObjects(in); diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index 662082c515..95beb58a30 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -55,7 +55,7 @@ class GuiExport UrlHandler : public QObject Q_OBJECT public: - UrlHandler(QObject* parent = 0) + UrlHandler(QObject* parent = nullptr) : QObject(parent){ } virtual ~UrlHandler() { @@ -85,7 +85,7 @@ public: * Constructs an empty main window. For default \a parent is 0, as there usually is * no toplevel window there. */ - MainWindow(QWidget * parent = 0, Qt::WindowFlags f = Qt::Window); + MainWindow(QWidget * parent = nullptr, Qt::WindowFlags f = Qt::Window); /** Destroys the object and frees any allocated resources. */ ~MainWindow(); /** @@ -225,7 +225,7 @@ public Q_SLOTS: bool closeAllDocuments (bool close=true); /** Pop up a message box asking for saving document */ - int confirmSave(const char *docName, QWidget *parent=0, bool addCheckBox=false); + int confirmSave(const char *docName, QWidget *parent=nullptr, bool addCheckBox=false); /** * Activates the next window in the child window chain. */ diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 45b662a7a3..7b26871d86 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -159,7 +159,7 @@ void AlignmentGroup::setRandomColor() Gui::Document* AlignmentGroup::getDocument() const { if (this->_views.empty()) - return 0; + return nullptr; App::DocumentObject* pView = this->_views[0]->getObject(); if (pView) { App::Document* rDoc = pView->getDocument(); @@ -167,7 +167,7 @@ Gui::Document* AlignmentGroup::getDocument() const return pDoc; } - return 0; + return nullptr; } void AlignmentGroup::addPoint(const PickedPoint& pnt) @@ -377,7 +377,7 @@ public: smoothing = true; } - QSplitter* mainSplitter=0; + QSplitter* mainSplitter=nullptr; mainSplitter = new QSplitter(Qt::Horizontal, this); if (glformat) { _viewer.push_back(new View3DInventorViewer(f, mainSplitter)); @@ -498,7 +498,7 @@ public: SbVec3f pos_cam1, pos_cam2; Private() - : sensorCam1(0), sensorCam2(0) + : sensorCam1(nullptr), sensorCam2(nullptr) { // left view picksepLeft = new SoSeparator; @@ -518,7 +518,7 @@ public: static void reorientCamera(SoCamera * cam, const SbRotation & rot) { - if (cam == NULL) return; + if (cam == nullptr) return; // Find global coordinates of focal point. SbVec3f direction; @@ -648,13 +648,13 @@ public: /* TRANSLATOR Gui::ManualAlignment */ -ManualAlignment* ManualAlignment::_instance = 0; +ManualAlignment* ManualAlignment::_instance = nullptr; /** * Construction. */ ManualAlignment::ManualAlignment() - : myViewer(0), myDocument(0), myPickPoints(3), d(new Private) + : myViewer(nullptr), myDocument(nullptr), myPickPoints(3), d(new Private) { // connect with the application's signal for deletion of documents this->connectApplicationDeletedDocument = Gui::Application::Instance->signalDeleteDocument @@ -674,7 +674,7 @@ ManualAlignment::~ManualAlignment() this->connectApplicationDeletedDocument.disconnect(); closeViewer(); delete d; - _instance = 0; + _instance = nullptr; } /** @@ -695,7 +695,7 @@ void ManualAlignment::destruct() { if (_instance) { ManualAlignment* tmp = _instance; - _instance = 0; + _instance = nullptr; delete tmp; } } @@ -705,7 +705,7 @@ void ManualAlignment::destruct() */ bool ManualAlignment::hasInstance() { - return _instance != 0; + return _instance != nullptr; } void ManualAlignment::setMinPoints(int minPoints) @@ -729,7 +729,7 @@ void ManualAlignment::clearAll() { myFixedGroup.clear(); myAlignModel.clear(); - myDocument = 0; + myDocument = nullptr; } void ManualAlignment::setViewingDirections(const Base::Vector3d& view1, const Base::Vector3d& up1, @@ -889,7 +889,7 @@ void ManualAlignment::closeViewer() // Close the viewer if (myViewer->parentWidget()) myViewer->parentWidget()->deleteLater(); - myViewer = 0; + myViewer = nullptr; } /** @@ -911,7 +911,7 @@ void ManualAlignment::reset() if (myDocument) { this->connectDocumentDeletedObject.disconnect(); - myDocument = 0; + myDocument = nullptr; } } diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index 7fc1be660f..7d7d191bf4 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -81,7 +81,7 @@ MenuItem* MenuItem::findItem(const std::string& name) } } - return 0; + return nullptr; } MenuItem* MenuItem::findParentOf(const std::string& name) @@ -141,7 +141,7 @@ MenuItem* MenuItem::afterItem(MenuItem* item) const { int pos = _items.indexOf(item); if (pos < 0 || pos+1 == _items.size()) - return 0; + return nullptr; return _items.at(pos+1); } @@ -179,7 +179,7 @@ QList MenuItem::getItems() const // ----------------------------------------------------------- -MenuManager* MenuManager::_instance=0; +MenuManager* MenuManager::_instance=nullptr; MenuManager* MenuManager::getInstance() { @@ -191,7 +191,7 @@ MenuManager* MenuManager::getInstance() void MenuManager::destruct() { delete _instance; - _instance = 0; + _instance = nullptr; } MenuManager::MenuManager() @@ -384,7 +384,7 @@ QAction* MenuManager::findAction(const QList& acts, const QString& ite return *it; } - return 0; // no item with the user data found + return nullptr; // no item with the user data found } QList MenuManager::findActions(const QList& acts, const QString& item) const diff --git a/src/Gui/MergeDocuments.cpp b/src/Gui/MergeDocuments.cpp index 4c128fd45e..8b7dcfd3e6 100644 --- a/src/Gui/MergeDocuments.cpp +++ b/src/Gui/MergeDocuments.cpp @@ -121,7 +121,7 @@ private: }; } -MergeDocuments::MergeDocuments(App::Document* doc) : stream(0), appdoc(doc) +MergeDocuments::MergeDocuments(App::Document* doc) : stream(nullptr), appdoc(doc) { connectExport = doc->signalExportObjects.connect (boost::bind(&MergeDocuments::exportObject, this, bp::_1, bp::_2)); @@ -150,7 +150,7 @@ MergeDocuments::importObjects(std::istream& input) std::vector objs = appdoc->importObjects(reader); delete this->stream; - this->stream = 0; + this->stream = nullptr; return objs; } diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index f7bdb61223..ecfea6f386 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -38,7 +38,7 @@ using namespace Gui; -AbstractMouseSelection::AbstractMouseSelection() : _pcView3D(0) +AbstractMouseSelection::AbstractMouseSelection() : _pcView3D(nullptr) { m_iXold = 0; m_iYold = 0; @@ -63,7 +63,7 @@ void AbstractMouseSelection::releaseMouseModel(bool abort) terminate(abort); _pcView3D->getWidget()->setCursor(m_cPrevCursor); - _pcView3D = 0; + _pcView3D = nullptr; } } diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 625856719b..f36624c2cb 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -269,7 +269,7 @@ NaviCubeImplementation::NaviCubeImplementation( OnChange(*hGrp, "ButtonColor"); OnChange(*hGrp, "CubeSize"); - m_PickingFramebuffer = NULL; + m_PickingFramebuffer = nullptr; m_Menu = createNaviCubeMenu(); } @@ -669,7 +669,7 @@ void NaviCubeImplementation::initNaviCube(QtGLWidget* gl) { // first create front and backside of faces float gap = 0.12f; - m_Textures[TEX_FRONT_FACE] = createCubeFaceTex(gl, gap, NULL, SHAPE_SQUARE); + m_Textures[TEX_FRONT_FACE] = createCubeFaceTex(gl, gap, nullptr, SHAPE_SQUARE); vector labels = NaviCubeImplementation::m_labels; @@ -721,7 +721,7 @@ void NaviCubeImplementation::initNaviCube(QtGLWidget* gl) { addFace(x, z, TEX_BOTTOM, TEX_FRONT_FACE, TEX_BOTTOM, true); // add corner faces - m_Textures[TEX_CORNER_FACE] = createCubeFaceTex(gl, gap, NULL, SHAPE_CORNER); + m_Textures[TEX_CORNER_FACE] = createCubeFaceTex(gl, gap, nullptr, SHAPE_CORNER); // we need to rotate to the edge, thus matrix for rotation angle of 54.7 deg cs = cos(atan(sqrt(2.0))); sn = sin(atan(sqrt(2.0))); @@ -758,7 +758,7 @@ void NaviCubeImplementation::initNaviCube(QtGLWidget* gl) { addFace(x, z, TEX_CORNER_FACE, TEX_CORNER_FACE, TEX_TOP_REAR_RIGHT); // add edge faces - m_Textures[TEX_EDGE_FACE] = createCubeFaceTex(gl, gap, NULL, SHAPE_EDGE); + m_Textures[TEX_EDGE_FACE] = createCubeFaceTex(gl, gap, nullptr, SHAPE_EDGE); // first back to top side x[0] = 1; x[1] = 0; x[2] = 0; z[0] = 0; z[1] = 0; z[2] = 1; @@ -872,7 +872,7 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) { // FIXME actually now that we have Qt5, we could probably do this earlier (as we do not need the opengl context) if (!m_NaviCubeInitialised) { QtGLWidget* gl = static_cast(m_View3DInventorViewer->viewport()); - if (gl == NULL) + if (gl == nullptr) return; initNaviCube(gl); m_NaviCubeInitialised = true; diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index 13941c0ea0..3b43290d9e 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -1315,7 +1315,7 @@ void NavigationStyle::abortSelection() if (mouseSelection) { mouseSelection->releaseMouseModel(true); delete mouseSelection; - mouseSelection = 0; + mouseSelection = nullptr; } } diff --git a/src/Gui/NetworkRetriever.h b/src/Gui/NetworkRetriever.h index 4fa065cde7..51110c387f 100644 --- a/src/Gui/NetworkRetriever.h +++ b/src/Gui/NetworkRetriever.h @@ -42,7 +42,7 @@ class NetworkRetriever : public QObject Q_OBJECT public: - NetworkRetriever( QObject * parent = 0 ); + NetworkRetriever( QObject * parent = nullptr ); virtual ~NetworkRetriever(); void setNumberOfTries( int ); @@ -82,7 +82,7 @@ class StdCmdDownloadOnlineHelp : public QObject, public Command Q_OBJECT public: - StdCmdDownloadOnlineHelp(QObject * parent = 0); + StdCmdDownloadOnlineHelp(QObject * parent = nullptr); virtual ~StdCmdDownloadOnlineHelp(); /** i18n stuff of the command. */ virtual void languageChange(); diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index fdf824cb33..049f1a15c1 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -354,7 +354,7 @@ void HttpServer::discardClient() /* TRANSLATOR Gui::StdCmdPythonHelp */ StdCmdPythonHelp::StdCmdPythonHelp() - : Command("Std_PythonHelp"), server(0) + : Command("Std_PythonHelp"), server(nullptr) { sGroup = "Tools"; sMenuText = QT_TR_NOOP("Automatic python modules documentation"); diff --git a/src/Gui/OnlineDocumentation.h b/src/Gui/OnlineDocumentation.h index cf03358c78..ea38b59c93 100644 --- a/src/Gui/OnlineDocumentation.h +++ b/src/Gui/OnlineDocumentation.h @@ -60,7 +60,7 @@ class HttpServer : public QTcpServer Q_OBJECT public: - HttpServer(QObject* parent = 0); + HttpServer(QObject* parent = nullptr); void incomingConnection(qintptr socket); void pause(); diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 2a07b6ba5a..c9810d749b 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -182,7 +182,7 @@ QWidget* Placement::getInvalidInput() const if (!(*it)->hasValidInput()) return (*it); } - return 0; + return nullptr; } void Placement::revertTransformation() @@ -845,7 +845,7 @@ TaskPlacement::TaskPlacement() this->setButtonPosition(TaskPlacement::South); widget = new Placement(); widget->showDefaultButtons(false); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index f18e1013ef..fd70e9631d 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -43,7 +43,7 @@ class GuiExport Placement : public Gui::LocationDialog Q_OBJECT public: - Placement(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + Placement(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~Placement(); void accept(); void reject(); @@ -114,7 +114,7 @@ class GuiExport DockablePlacement : public Placement Q_OBJECT public: - DockablePlacement(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DockablePlacement(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DockablePlacement(); void accept(); diff --git a/src/Gui/PrefWidgets.h b/src/Gui/PrefWidgets.h index 6eb77dd6a8..3ec2ea7f38 100644 --- a/src/Gui/PrefWidgets.h +++ b/src/Gui/PrefWidgets.h @@ -107,7 +107,7 @@ class GuiExport PrefSpinBox : public QSpinBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefSpinBox ( QWidget * parent = 0 ); + PrefSpinBox ( QWidget * parent = nullptr ); virtual ~PrefSpinBox(); protected: @@ -127,7 +127,7 @@ class GuiExport PrefDoubleSpinBox : public QDoubleSpinBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefDoubleSpinBox ( QWidget * parent = 0 ); + PrefDoubleSpinBox ( QWidget * parent = nullptr ); virtual ~PrefDoubleSpinBox(); protected: @@ -148,7 +148,7 @@ class GuiExport PrefLineEdit : public QLineEdit, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefLineEdit ( QWidget * parent = 0 ); + PrefLineEdit ( QWidget * parent = nullptr ); virtual ~PrefLineEdit(); protected: @@ -169,7 +169,7 @@ class GuiExport PrefTextEdit : public QTextEdit, public PrefWidget Q_PROPERTY(QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath) public: - PrefTextEdit(QWidget* parent = 0); + PrefTextEdit(QWidget* parent = nullptr); virtual ~PrefTextEdit(); protected: @@ -190,7 +190,7 @@ class GuiExport PrefFileChooser : public FileChooser, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefFileChooser ( QWidget * parent = 0 ); + PrefFileChooser ( QWidget * parent = nullptr ); virtual ~PrefFileChooser(); protected: @@ -211,7 +211,7 @@ class GuiExport PrefComboBox : public QComboBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefComboBox ( QWidget * parent = 0 ); + PrefComboBox ( QWidget * parent = nullptr ); virtual ~PrefComboBox(); protected: @@ -232,7 +232,7 @@ class GuiExport PrefCheckBox : public QCheckBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefCheckBox ( QWidget * parent = 0 ); + PrefCheckBox ( QWidget * parent = nullptr ); virtual ~PrefCheckBox(); protected: @@ -253,7 +253,7 @@ class GuiExport PrefRadioButton : public QRadioButton, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefRadioButton ( QWidget * parent = 0 ); + PrefRadioButton ( QWidget * parent = nullptr ); virtual ~PrefRadioButton(); protected: @@ -274,7 +274,7 @@ class GuiExport PrefSlider : public QSlider, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefSlider ( QWidget * parent = 0 ); + PrefSlider ( QWidget * parent = nullptr ); virtual ~PrefSlider(); protected: @@ -295,7 +295,7 @@ class GuiExport PrefColorButton : public ColorButton, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefColorButton ( QWidget * parent = 0 ); + PrefColorButton ( QWidget * parent = nullptr ); virtual ~PrefColorButton(); protected: @@ -317,7 +317,7 @@ class GuiExport PrefUnitSpinBox : public QuantitySpinBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefUnitSpinBox ( QWidget * parent = 0 ); + PrefUnitSpinBox ( QWidget * parent = nullptr ); virtual ~PrefUnitSpinBox(); protected: @@ -382,7 +382,7 @@ class GuiExport PrefFontBox : public QFontComboBox, public PrefWidget Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath ) public: - PrefFontBox ( QWidget * parent = 0 ); + PrefFontBox ( QWidget * parent = nullptr ); virtual ~PrefFontBox(); protected: diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index 97f6b84a1f..fa696abb34 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -84,7 +84,7 @@ struct ProgressBarPrivate }; } -SequencerBar* SequencerBar::_pclSingleton = 0; +SequencerBar* SequencerBar::_pclSingleton = nullptr; SequencerBar* SequencerBar::instance() { @@ -100,8 +100,8 @@ SequencerBar* SequencerBar::instance() SequencerBar::SequencerBar() { d = new SequencerBarPrivate; - d->bar = 0; - d->waitCursor = 0; + d->bar = nullptr; + d->waitCursor = nullptr; d->guiThread = true; } @@ -336,7 +336,7 @@ void SequencerBar::resetData() // in Qt. The message is QEventDispatcherUNIX::unregisterTimer: invalid argument. d->bar->aboutToHide(); delete d->waitCursor; - d->waitCursor = 0; + d->waitCursor = nullptr; d->bar->leaveControlEvents(d->guiThread); getMainWindow()->setPaneText(1, QString()); getMainWindow()->showMessage(QString()); @@ -553,7 +553,7 @@ void ProgressBar::setupTaskBarProgress() bool ProgressBar::eventFilter(QObject* o, QEvent* e) { - if (sequencer->isRunning() && e != 0) { + if (sequencer->isRunning() && e != nullptr) { QThread* currentThread = QThread::currentThread(); QThread* thr = this->thread(); // this is the main thread if (thr != currentThread) { diff --git a/src/Gui/ProgressBar.h b/src/Gui/ProgressBar.h index 2bb1b6c190..f27d09233e 100644 --- a/src/Gui/ProgressBar.h +++ b/src/Gui/ProgressBar.h @@ -104,7 +104,7 @@ public: void resume() override; bool isBlocking() const override; /** Returns an instance of the progress bar. It creates one if needed. */ - QProgressBar* getProgressBar(QWidget* parent=0); + QProgressBar* getProgressBar(QWidget* parent=nullptr); virtual void checkAbort() override; @@ -145,7 +145,7 @@ class ProgressBar : public QProgressBar public: /** Construction */ - ProgressBar (SequencerBar* s, QWidget * parent=0); + ProgressBar (SequencerBar* s, QWidget * parent=nullptr); /** Destruction */ ~ProgressBar (); diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp index d6839dfd57..06bdf13382 100644 --- a/src/Gui/ProgressDialog.cpp +++ b/src/Gui/ProgressDialog.cpp @@ -50,7 +50,7 @@ struct SequencerDialogPrivate } -SequencerDialog* SequencerDialog::_pclSingleton = 0; +SequencerDialog* SequencerDialog::_pclSingleton = nullptr; SequencerDialog* SequencerDialog::instance() { diff --git a/src/Gui/ProgressDialog.h b/src/Gui/ProgressDialog.h index 75cb61ee8b..0297563f90 100644 --- a/src/Gui/ProgressDialog.h +++ b/src/Gui/ProgressDialog.h @@ -83,7 +83,7 @@ class ProgressDialog : public QProgressDialog public: /** Construction */ - ProgressDialog (SequencerDialog* s, QWidget * parent=0); + ProgressDialog (SequencerDialog* s, QWidget * parent=nullptr); /** Destruction */ ~ProgressDialog (); diff --git a/src/Gui/ProjectView.h b/src/Gui/ProjectView.h index f65ca5b83c..7718d7ca8f 100644 --- a/src/Gui/ProjectView.h +++ b/src/Gui/ProjectView.h @@ -39,7 +39,7 @@ class ProjectWidget : public QTreeView Q_OBJECT public: - ProjectWidget(QWidget* parent=0); + ProjectWidget(QWidget* parent=nullptr); ~ProjectWidget(); private: diff --git a/src/Gui/PropertyPage.cpp b/src/Gui/PropertyPage.cpp index 63e9ecaa33..22e2616364 100644 --- a/src/Gui/PropertyPage.cpp +++ b/src/Gui/PropertyPage.cpp @@ -117,7 +117,7 @@ void PreferencePage::changeEvent(QEvent *e) // ---------------------------------------------------------------- PreferenceUiForm::PreferenceUiForm(const QString& fn, QWidget* parent) - : PreferencePage(parent), form(0) + : PreferencePage(parent), form(nullptr) { UiLoader loader; loader.setLanguageChangeEnabled(true); diff --git a/src/Gui/PropertyPage.h b/src/Gui/PropertyPage.h index 486d42ea50..024686b906 100644 --- a/src/Gui/PropertyPage.h +++ b/src/Gui/PropertyPage.h @@ -38,7 +38,7 @@ class GuiExport PropertyPage : public QWidget Q_OBJECT public: - PropertyPage(QWidget* parent = 0); + PropertyPage(QWidget* parent = nullptr); virtual ~PropertyPage(); bool isModified(); @@ -68,7 +68,7 @@ class GuiExport PreferencePage : public QWidget Q_OBJECT public: - PreferencePage(QWidget* parent = 0); + PreferencePage(QWidget* parent = nullptr); virtual ~PreferencePage(); public Q_SLOTS: @@ -87,7 +87,7 @@ class GuiExport PreferenceUiForm : public PreferencePage Q_OBJECT public: - PreferenceUiForm(const QString& fn, QWidget* parent = 0); + PreferenceUiForm(const QString& fn, QWidget* parent = nullptr); virtual ~PreferenceUiForm(); void loadSettings(); @@ -114,7 +114,7 @@ class GuiExport CustomizeActionPage : public QWidget Q_OBJECT public: - CustomizeActionPage(QWidget* parent = 0); + CustomizeActionPage(QWidget* parent = nullptr); virtual ~CustomizeActionPage(); protected: diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 022ec31f24..3fcc88fc09 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -369,7 +369,7 @@ void PropertyView::onTimer() { std::vector propDataMap; std::vector propViewMap; bool checkLink = true; - ViewProviderDocumentObject *vpLast = 0; + ViewProviderDocumentObject *vpLast = nullptr; auto sels = Gui::Selection().getSelectionEx("*"); for(auto &sel : sels) { App::DocumentObject *ob = sel.getObject(); diff --git a/src/Gui/PropertyView.h b/src/Gui/PropertyView.h index 41bfec50ba..ff6a5e8aee 100644 --- a/src/Gui/PropertyView.h +++ b/src/Gui/PropertyView.h @@ -56,7 +56,7 @@ class PropertyView : public QWidget, public Gui::SelectionObserver Q_OBJECT public: - PropertyView(QWidget *parent=0); + PropertyView(QWidget *parent=nullptr); virtual ~PropertyView(); Gui::PropertyEditor::PropertyEditor* propertyEditorView; @@ -89,7 +89,7 @@ private: void slotDeletedViewObject(const Gui::ViewProvider&); void slotDeletedObject(const App::DocumentObject&); - void checkEnable(const char *doc = 0); + void checkEnable(const char *doc = nullptr); private: struct PropInfo; @@ -120,7 +120,7 @@ class PropertyDockView : public Gui::DockWindow Q_OBJECT public: - PropertyDockView(Gui::Document* pcDocument, QWidget *parent=0); + PropertyDockView(Gui::Document* pcDocument, QWidget *parent=nullptr); virtual ~PropertyDockView(); }; diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 979e0ff3ab..d11c0d667b 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -92,12 +92,12 @@ struct PythonConsoleP PythonConsoleP() { type = Normal; - _stdoutPy = 0; - _stderrPy = 0; - _stdinPy = 0; - _stdin = 0; - interpreter = 0; - callTipsList = 0; + _stdoutPy = nullptr; + _stderrPy = nullptr; + _stdinPy = nullptr; + _stdin = nullptr; + interpreter = nullptr; + callTipsList = nullptr; interactive = false; historyFile = QString::fromUtf8((App::Application::getUserAppDataDir() + "PythonHistory.log").c_str()); colormap[QLatin1String("Text")] = Qt::black; @@ -201,7 +201,7 @@ PyObject* InteractiveInterpreter::compile(const char* source) const } // can never happen - return 0; + return nullptr; } /** @@ -273,7 +273,7 @@ bool InteractiveInterpreter::runSource(const char* source) const // message we don't need. PyObject *errobj, *errdata, *errtraceback; PyErr_Fetch(&errobj, &errdata, &errtraceback); - PyErr_Restore(errobj, errdata, 0); + PyErr_Restore(errobj, errdata, nullptr); // print error message if (PyErr_Occurred()) PyErr_Print(); return false; @@ -300,10 +300,10 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const Base::PyGILStateLocker lock; PyObject *module, *dict, *presult; /* "exec code in d, d" */ module = PyImport_AddModule("__main__"); /* get module, init python */ - if (module == NULL) + if (module == nullptr) throw Base::PyException(); /* not incref'd */ dict = PyModule_GetDict(module); /* get dict namespace */ - if (dict == NULL) + if (dict == nullptr) throw Base::PyException(); /* not incref'd */ // It seems that the return value is always 'None' or Null @@ -404,7 +404,7 @@ void InteractiveInterpreter::clearBuffer() * Constructs a PythonConsole which is a child of 'parent'. */ PythonConsole::PythonConsole(QWidget *parent) - : TextEdit(parent), WindowParameter( "Editor" ), _sourceDrain(NULL) + : TextEdit(parent), WindowParameter( "Editor" ), _sourceDrain(nullptr) { d = new PythonConsoleP(); d->interactive = false; @@ -1376,7 +1376,7 @@ QString PythonConsole::readline( void ) // application is about to quit if (loop.exec() != 0) { PyErr_SetInterrupt(); } //< send SIGINT to python - this->_sourceDrain = NULL; //< disable source drain + this->_sourceDrain = nullptr; //< disable source drain return inputBuffer.append(QChar::fromLatin1('\n')); //< pass a newline here, since the readline-caller may need it! } diff --git a/src/Gui/PythonConsole.h b/src/Gui/PythonConsole.h index bf2fa508a0..f0ac8e0c43 100644 --- a/src/Gui/PythonConsole.h +++ b/src/Gui/PythonConsole.h @@ -105,7 +105,7 @@ public: Special = 3 }; - PythonConsole(QWidget *parent = 0); + PythonConsole(QWidget *parent = nullptr); ~PythonConsole(); void OnChange( Base::Subject &rCaller,const char* rcReason ); diff --git a/src/Gui/PythonConsolePy.cpp b/src/Gui/PythonConsolePy.cpp index 7273c390e2..e8dd6786a2 100644 --- a/src/Gui/PythonConsolePy.cpp +++ b/src/Gui/PythonConsolePy.cpp @@ -71,7 +71,7 @@ Py::Object PythonStdout::write(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "O!",&PyUnicode_Type, &output)) throw Py::TypeError("PythonStdout.write() takes exactly one argument of type str"); - PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", 0); + PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", nullptr); if (unicode) { const char* string = PyBytes_AsString(unicode); int maxlen = qstrlen(string) > 10000 ? 10000 : -1; @@ -137,7 +137,7 @@ Py::Object PythonStderr::write(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "O!",&PyUnicode_Type, &output)) throw Py::TypeError("PythonStderr.write() takes exactly one argument of type str"); - PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", 0); + PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", nullptr); if (unicode) { const char* string = PyBytes_AsString(unicode); int maxlen = qstrlen(string) > 10000 ? 10000 : -1; @@ -202,7 +202,7 @@ Py::Object OutputStdout::write(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "O!",&PyUnicode_Type, &output)) throw Py::TypeError("OutputStdout.write() takes exactly one argument of type str"); - PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", 0); + PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", nullptr); if (unicode) { const char* string = PyBytes_AsString(unicode); Base::Console().Message("%s",string); @@ -267,7 +267,7 @@ Py::Object OutputStderr::write(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "O!",&PyUnicode_Type, &output)) throw Py::TypeError("OutputStderr.write() takes exactly one argument of type str"); - PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", 0); + PyObject* unicode = PyUnicode_AsEncodedString(output, "utf-8", nullptr); if (unicode) { const char* string = PyBytes_AsString(unicode); Base::Console().Error("%s",string); diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index fd772cb865..c733340605 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -353,9 +353,9 @@ struct PythonDebuggerP { PythonDebuggerP(PythonDebugger* that) : init(false), trystop(false), running(false) { - out_o = 0; - err_o = 0; - exc_o = 0; + out_o = nullptr; + err_o = nullptr; + exc_o = nullptr; Base::PyGILStateLocker lock; out_n = new PythonDebugStdout(); err_n = new PythonDebugStderr(); @@ -437,9 +437,9 @@ void PythonDebugger::runFile(const QString& fn) module = PyImport_AddModule("__main__"); dict = PyModule_GetDict(module); dict = PyDict_Copy(dict); - if (PyDict_GetItemString(dict, "__file__") == NULL) { + if (PyDict_GetItemString(dict, "__file__") == nullptr) { PyObject *f = PyUnicode_FromString((const char*)pxFileName); - if (f == NULL) { + if (f == nullptr) { fclose(fp); return; } @@ -497,7 +497,7 @@ bool PythonDebugger::stop() if (!d->init) return false; Base::PyGILStateLocker lock; - PyEval_SetTrace(NULL, NULL); + PyEval_SetTrace(nullptr, nullptr); PySys_SetObject("stdout", d->out_o); PySys_SetObject("stderr", d->err_o); PySys_SetObject("excepthook", d->exc_o); @@ -528,7 +528,7 @@ void PythonDebugger::stepRun() void PythonDebugger::showDebugMarker(const QString& fn, int line) { - PythonEditorView* edit = 0; + PythonEditorView* edit = nullptr; QList mdis = getMainWindow()->windows(); for (QList::iterator it = mdis.begin(); it != mdis.end(); ++it) { edit = qobject_cast(*it); @@ -551,7 +551,7 @@ void PythonDebugger::showDebugMarker(const QString& fn, int line) void PythonDebugger::hideDebugMarker(const QString& fn) { - PythonEditorView* edit = 0; + PythonEditorView* edit = nullptr; QList mdis = getMainWindow()->windows(); for (QList::iterator it = mdis.begin(); it != mdis.end(); ++it) { edit = qobject_cast(*it); diff --git a/src/Gui/PythonEditor.h b/src/Gui/PythonEditor.h index 6ffc9e46d6..d2851e6670 100644 --- a/src/Gui/PythonEditor.h +++ b/src/Gui/PythonEditor.h @@ -41,7 +41,7 @@ class GuiExport PythonEditor : public TextEditor Q_OBJECT public: - PythonEditor(QWidget *parent = 0); + PythonEditor(QWidget *parent = nullptr); ~PythonEditor(); void toggleBreakpoint(); diff --git a/src/Gui/QListWidgetCustom.cpp b/src/Gui/QListWidgetCustom.cpp index 6dc2ec9a7d..9c221387f1 100644 --- a/src/Gui/QListWidgetCustom.cpp +++ b/src/Gui/QListWidgetCustom.cpp @@ -46,7 +46,7 @@ QListWidgetCustom::~QListWidgetCustom() */ void QListWidgetCustom::dragMoveEvent(QDragMoveEvent *e) { - if (e->source() != 0) { + if (e->source() != nullptr) { QVariant prop = this->property("OnlyAcceptFrom"); if (prop.isValid()) { QStringList filter = prop.toStringList(); diff --git a/src/Gui/QuantitySpinBox.h b/src/Gui/QuantitySpinBox.h index 9131692d52..8bbd96ca5b 100644 --- a/src/Gui/QuantitySpinBox.h +++ b/src/Gui/QuantitySpinBox.h @@ -49,7 +49,7 @@ class GuiExport QuantitySpinBox : public QAbstractSpinBox, public ExpressionSpin Q_PROPERTY(QString expression READ expressionText) public: - explicit QuantitySpinBox(QWidget *parent = 0); + explicit QuantitySpinBox(QWidget *parent = nullptr); virtual ~QuantitySpinBox(); /// Get the current quantity diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index c4dc0dbcef..c4881ca263 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -361,12 +361,12 @@ public: { if (replace_stdout) { Py_DECREF(replace_stdout); - replace_stdout = 0; + replace_stdout = nullptr; } if (replace_stderr) { Py_DECREF(replace_stderr); - replace_stderr = 0; + replace_stderr = nullptr; } } diff --git a/src/Gui/ReportView.h b/src/Gui/ReportView.h index f396e4ffbe..54187b253c 100644 --- a/src/Gui/ReportView.h +++ b/src/Gui/ReportView.h @@ -51,7 +51,7 @@ class ReportView : public QWidget Q_OBJECT public: - ReportView( QWidget* parent = 0); + ReportView( QWidget* parent = nullptr); ~ReportView(); protected: @@ -128,7 +128,7 @@ class GuiExport ReportOutput : public QTextEdit, public WindowParameter, public Q_OBJECT public: - ReportOutput(QWidget* parent=0); + ReportOutput(QWidget* parent=nullptr); virtual ~ReportOutput(); /** Observes its parameter group. */ diff --git a/src/Gui/SceneInspector.h b/src/Gui/SceneInspector.h index 6a841af4b9..2fb933b4c3 100644 --- a/src/Gui/SceneInspector.h +++ b/src/Gui/SceneInspector.h @@ -71,7 +71,7 @@ class DlgInspector : public QDialog Q_OBJECT public: - DlgInspector(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgInspector(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgInspector(); void setDocument(Gui::Document* doc); diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index 52dffe6ee0..aa79a4b80e 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -185,7 +185,7 @@ void SelectionObserverPython::addObserver(const Py::Object& obj, int resolve) void SelectionObserverPython::removeObserver(const Py::Object& obj) { - SelectionObserverPython* obs=0; + SelectionObserverPython* obs=nullptr; for (std::vector::iterator it = _instances.begin(); it != _instances.end(); ++it) { if ((*it)->inst == obj) { @@ -374,7 +374,7 @@ std::vector SelectionSingleton::getSelection(const c if(single) temp.reserve(1); SelObj tempSelObj; - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!pDocName || strcmp(pDocName,"*")!=0) { pcDoc = getDocument(pDocName); if (!pcDoc) @@ -385,7 +385,7 @@ std::vector SelectionSingleton::getSelection(const c for(auto &sel : _SelList) { if(!sel.pDoc) continue; - const char *subelement = 0; + const char *subelement = nullptr; auto obj = getObjectOfType(sel,App::DocumentObject::getClassTypeId(),resolve,&subelement); if(!obj || (pcDoc && sel.pObject->getDocument()!=pcDoc)) continue; @@ -418,7 +418,7 @@ std::vector SelectionSingleton::getSelection(const c bool SelectionSingleton::hasSelection(const char* doc, bool resolve) const { - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!doc || strcmp(doc,"*")!=0) { pcDoc = getDocument(doc); if (!pcDoc) @@ -437,7 +437,7 @@ bool SelectionSingleton::hasSelection(const char* doc, bool resolve) const bool SelectionSingleton::hasSubSelection(const char* doc, bool subElement) const { - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!doc || strcmp(doc,"*")!=0) { pcDoc = getDocument(doc); if (!pcDoc) @@ -462,7 +462,7 @@ std::vector SelectionSingleton::getPickedList(const std::vector temp; SelObj tempSelObj; - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!pDocName || strcmp(pDocName,"*")!=0) { pcDoc = getDocument(pDocName); if (!pcDoc) @@ -508,7 +508,7 @@ std::vector SelectionSingleton::getObjectList(const char* pDocN if (typeId == Base::Type::badType()) return temp; - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!pDocName || strcmp(pDocName,"*")!=0) { pcDoc = getDocument(pDocName); if (!pcDoc) @@ -517,7 +517,7 @@ std::vector SelectionSingleton::getObjectList(const char* pDocN for (auto &sel : objList) { if(!sel.pDoc) continue; - const char *subelement = 0; + const char *subelement = nullptr; auto obj = getObjectOfType(sel,typeId,resolve,&subelement); if(!obj || (pcDoc && sel.pObject->getDocument()!=pcDoc)) continue; @@ -637,7 +637,7 @@ App::DocumentObject *SelectionSingleton::getObjectOfType(_SelObj &sel, { auto obj = sel.pObject; if(!obj || !obj->getNameInDocument()) - return 0; + return nullptr; const char *subname = sel.SubName.c_str(); if(resolve) { obj = sel.pResolvedObject; @@ -647,10 +647,10 @@ App::DocumentObject *SelectionSingleton::getObjectOfType(_SelObj &sel, subname = sel.elementName.second.c_str(); } if(!obj) - return 0; + return nullptr; if(!obj->isDerivedFrom(typeId) && (resolve!=3 || !obj->getLinkedObject(true)->isDerivedFrom(typeId))) - return 0; + return nullptr; if(subelement) *subelement = subname; return obj; } @@ -659,7 +659,7 @@ vector SelectionSingleton::getObjectsOfType(const Base::Ty { std::vector temp; - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!pDocName || strcmp(pDocName,"*")!=0) { pcDoc = getDocument(pDocName); if (!pcDoc) @@ -691,7 +691,7 @@ std::vector SelectionSingleton::getObjectsOfType(const cha unsigned int SelectionSingleton::countObjectsOfType(const Base::Type& typeId, const char* pDocName, int resolve) const { unsigned int iNbr=0; - App::Document *pcDoc = 0; + App::Document *pcDoc = nullptr; if(!pDocName || strcmp(pDocName,"*")!=0) { pcDoc = getDocument(pDocName); if (!pcDoc) @@ -1066,7 +1066,7 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN // check for a Selection Gate if (ActiveGate) { - const char *subelement = 0; + const char *subelement = nullptr; auto pObject = getObjectOfType(temp,App::DocumentObject::getClassTypeId(),gateResolve,&subelement); if (!ActiveGate->allow(pObject?pObject->getDocument():temp.pDoc,pObject,subelement)) { if (getMainWindow()) { @@ -1206,7 +1206,7 @@ void SelectionSingleton::selStackGoForward(int count) { std::vector SelectionSingleton::selStackGet( const char* pDocName, int resolve, int index) const { - const SelStackItem *item = 0; + const SelStackItem *item = nullptr; if(index>=0) { if(index>=(int)_SelStackBack.size()) return {}; @@ -1313,7 +1313,7 @@ bool SelectionSingleton::addSelection(const SelectionObject& obj,bool clearPrese ok &= addSelection(obj.getDocName(), obj.getFeatName(), name.c_str(), static_cast(pnt.x), static_cast(pnt.y), - static_cast(pnt.z),0,clearPreselect); + static_cast(pnt.z),nullptr,clearPreselect); } return ok; } @@ -1438,7 +1438,7 @@ void SelectionSingleton::setVisible(VisibleState vis) { if(!obj) continue; // get parent object - App::DocumentObject *parent = 0; + App::DocumentObject *parent = nullptr; std::string elementName; obj = obj->resolve(sel.SubName.c_str(),&parent,&elementName); if (!obj || !obj->getNameInDocument() || (parent && !parent->getNameInDocument())) @@ -1471,7 +1471,7 @@ void SelectionSingleton::setVisible(VisibleState vis) { // Fall back to direct object visibility setting } - if(!filter.insert(std::make_pair(obj,(App::DocumentObject*)0)).second){ + if(!filter.insert(std::make_pair(obj,(App::DocumentObject*)nullptr)).second){ continue; } @@ -1512,7 +1512,7 @@ void SelectionSingleton::setSelection(const char* pDocName, const std::vectorgetNameInDocument()) continue; _SelObj temp; - int ret = checkSelection(pDocName,obj->getNameInDocument(),0,0,temp); + int ret = checkSelection(pDocName,obj->getNameInDocument(),nullptr,0,temp); if(ret!=0) continue; touched = true; @@ -1636,7 +1636,7 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject if(pObjectName) sel.pObject = sel.pDoc->getObject(pObjectName); else - sel.pObject = 0; + sel.pObject = nullptr; if (!sel.pObject) { if(!selList) FC_ERR("Object not found"); @@ -1648,12 +1648,12 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject sel.SubName = pSubName; if(!resolve) TreeWidget::checkTopParent(sel.pObject,sel.SubName); - pSubName = sel.SubName.size()?sel.SubName.c_str():0; + pSubName = sel.SubName.size()?sel.SubName.c_str():nullptr; sel.FeatName = sel.pObject->getNameInDocument(); sel.TypeName = sel.pObject->getTypeId().getName(); - const char *element = 0; + const char *element = nullptr; sel.pResolvedObject = App::GeoFeature::resolveElement(sel.pObject, - pSubName,sel.elementName,false,App::GeoFeature::Normal,0,&element); + pSubName,sel.elementName,false,App::GeoFeature::Normal,nullptr,&element); if(!sel.pResolvedObject) { if(!selList) FC_ERR("Sub-object " << sel.DocName << '#' << sel.FeatName << '.' << sel.SubName << " not found"); @@ -1704,7 +1704,7 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject const char *SelectionSingleton::getSelectedElement(App::DocumentObject *obj, const char* pSubName) const { - if (!obj) return 0; + if (!obj) return nullptr; for(list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) { if (It->pObject == obj) { @@ -1717,7 +1717,7 @@ const char *SelectionSingleton::getSelectedElement(App::DocumentObject *obj, con } } } - return 0; + return nullptr; } void SelectionSingleton::slotDeletedObject(const App::DocumentObject& Obj) @@ -1778,7 +1778,7 @@ SelectionSingleton::SelectionSingleton() hx = 0; hy = 0; hz = 0; - ActiveGate = 0; + ActiveGate = nullptr; gateResolve = 1; App::GetApplication().signalDeletedObject.connect(boost::bind(&Gui::SelectionSingleton::slotDeletedObject, this, bp::_1)); signalSelectionChanged.connect(boost::bind(&Gui::SelectionSingleton::slotSelectionChanged, this, bp::_1)); @@ -1792,20 +1792,20 @@ SelectionSingleton::~SelectionSingleton() { } -SelectionSingleton* SelectionSingleton::_pcSingleton = NULL; +SelectionSingleton* SelectionSingleton::_pcSingleton = nullptr; SelectionSingleton& SelectionSingleton::instance(void) { - if (_pcSingleton == NULL) + if (_pcSingleton == nullptr) _pcSingleton = new SelectionSingleton; return *_pcSingleton; } void SelectionSingleton::destruct (void) { - if (_pcSingleton != NULL) + if (_pcSingleton != nullptr) delete _pcSingleton; - _pcSingleton = 0; + _pcSingleton = nullptr; } //************************************************************************** @@ -2024,7 +2024,7 @@ PyMethodDef SelectionSingleton::Methods[] = { " 0: do not resolve, 1: resolve, 2: resolve with element map.\n" "index : int\n Select stack index.\n" " 0: last pushed selection, > 0: trace back, < 0: trace forward."}, - {NULL, NULL, 0, NULL} /* Sentinel */ + {nullptr, nullptr, 0, nullptr} /* Sentinel */ }; PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) @@ -2037,7 +2037,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) float x = 0, y = 0, z = 0; if (PyArg_ParseTuple(args, "ss|sfffO!", &docname, &objname , &subname,&x,&y,&z,&PyBool_Type,&clearPreselect)) { - Selection().addSelection(docname,objname,subname,x,y,z,0,PyObject_IsTrue(clearPreselect)); + Selection().addSelection(docname,objname,subname,x,y,z,nullptr,PyObject_IsTrue(clearPreselect)); Py_Return; } @@ -2056,7 +2056,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) Selection().addSelection(docObj->getDocument()->getName(), docObj->getNameInDocument(), - subname,x,y,z,0,PyObject_IsTrue(clearPreselect)); + subname,x,y,z,nullptr,PyObject_IsTrue(clearPreselect)); Py_Return; } @@ -2079,7 +2079,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) std::string subname = static_cast(Py::String(*it)); Selection().addSelection(docObj->getDocument()->getName(), docObj->getNameInDocument(), - subname.c_str(),0,0,0,0,PyObject_IsTrue(clearPreselect)); + subname.c_str(),0,0,0,nullptr,PyObject_IsTrue(clearPreselect)); } Py_Return; @@ -2238,7 +2238,7 @@ PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *ar char* subname = nullptr; float x = 0, y = 0, z = 0; int type = 1; - static char *kwlist[] = {"obj","subname","x","y","z","tp",0}; + static char *kwlist[] = {"obj","subname","x","y","z","tp",nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwd, "O!|sfffi", kwlist, &(App::DocumentObjectPy::Type),&object,&subname,&x,&y,&z,&type)) { App::DocumentObjectPy* docObjPy = static_cast(object); diff --git a/src/Gui/Selection.h b/src/Gui/Selection.h index e931f5e398..926b276105 100644 --- a/src/Gui/Selection.h +++ b/src/Gui/Selection.h @@ -78,8 +78,8 @@ public: }; SelectionChanges(MsgType type = ClrSelection, - const char *docName=0, const char *objName=0, - const char *subName=0, const char *typeName=0, + const char *docName=nullptr, const char *objName=nullptr, + const char *subName=nullptr, const char *typeName=nullptr, float x=0, float y=0, float z=0, int subtype=0) : Type(type),SubType(subtype) , x(x),y(y),z(z) @@ -164,7 +164,7 @@ public: std::string TypeName; // Original selection message in case resolve!=0 - const SelectionChanges *pOriginalMsg = 0; + const SelectionChanges *pOriginalMsg = nullptr; }; } //namespace Gui @@ -325,7 +325,7 @@ public: class GuiExport SelectionGateFilterExternal: public SelectionGate { public: - SelectionGateFilterExternal(const char *docName, const char *objName=0); + SelectionGateFilterExternal(const char *docName, const char *objName=nullptr); virtual bool allow(App::Document*,App::DocumentObject*, const char*) override; private: std::string DocName; @@ -362,10 +362,10 @@ public: }; /// Add to selection - bool addSelection(const char* pDocName, const char* pObjectName=0, const char* pSubName=0, - float x=0, float y=0, float z=0, const std::vector *pickedList = 0, bool clearPreSelect=true); - bool addSelection2(const char* pDocName, const char* pObjectName=0, const char* pSubName=0, - float x=0, float y=0, float z=0, const std::vector *pickedList = 0) + bool addSelection(const char* pDocName, const char* pObjectName=nullptr, const char* pSubName=nullptr, + float x=0, float y=0, float z=0, const std::vector *pickedList = nullptr, bool clearPreSelect=true); + bool addSelection2(const char* pDocName, const char* pObjectName=nullptr, const char* pSubName=nullptr, + float x=0, float y=0, float z=0, const std::vector *pickedList = nullptr) { return addSelection(pDocName,pObjectName,pSubName,x,y,z,pickedList,false); } @@ -375,21 +375,21 @@ public: /// Add to selection with several sub-elements bool addSelections(const char* pDocName, const char* pObjectName, const std::vector& pSubNames); /// Update a selection - bool updateSelection(bool show, const char* pDocName, const char* pObjectName=0, const char* pSubName=0); + bool updateSelection(bool show, const char* pDocName, const char* pObjectName=nullptr, const char* pSubName=nullptr); /// Remove from selection (for internal use) - void rmvSelection(const char* pDocName, const char* pObjectName=0, const char* pSubName=0, - const std::vector *pickedList = 0); + void rmvSelection(const char* pDocName, const char* pObjectName=nullptr, const char* pSubName=nullptr, + const std::vector *pickedList = nullptr); /// Set the selection for a document void setSelection(const char* pDocName, const std::vector&); /// Clear the selection of document \a pDocName. If the document name is not given the selection of the active document is cleared. - void clearSelection(const char* pDocName=0, bool clearPreSelect=true); + void clearSelection(const char* pDocName=nullptr, bool clearPreSelect=true); /// Clear the selection of all documents void clearCompleteSelection(bool clearPreSelect=true); /// Check if selected - bool isSelected(const char* pDocName, const char* pObjectName=0, - const char* pSubName=0, int resolve=1) const; + bool isSelected(const char* pDocName, const char* pObjectName=nullptr, + const char* pSubName=nullptr, int resolve=1) const; /// Check if selected - bool isSelected(App::DocumentObject*, const char* pSubName=0, int resolve=1) const; + bool isSelected(App::DocumentObject*, const char* pSubName=nullptr, int resolve=1) const; const char *getSelectedElement(App::DocumentObject*, const char* pSubName) const; @@ -420,14 +420,14 @@ public: * field */ unsigned int countObjectsOfType(const Base::Type& typeId=App::DocumentObject::getClassTypeId(), - const char* pDocName=0, int resolve=1) const; + const char* pDocName=nullptr, int resolve=1) const; /** * Does basically the same as the method above unless that it accepts a string literal as first argument. * \a typeName must be a registered type, otherwise 0 is returned. */ unsigned int countObjectsOfType(const char* typeName, - const char* pDocName=0, int resolve=1) const; + const char* pDocName=nullptr, int resolve=1) const; /** Returns a vector of objects of type \a TypeName selected for the given document name \a pDocName. * If no document name is specified the objects from the active document are regarded. @@ -435,19 +435,19 @@ public: * @note The vector reflects the sequence of selection. */ std::vector getObjectsOfType(const Base::Type& typeId, - const char* pDocName=0, int resolve=1) const; + const char* pDocName=nullptr, int resolve=1) const; /** * Does basically the same as the method above unless that it accepts a string literal as first argument. * \a typeName must be a registered type otherwise an empty array is returned. */ std::vector getObjectsOfType(const char* typeName, - const char* pDocName=0, int resolve=1) const; + const char* pDocName=nullptr, int resolve=1) const; /** * A convenience template-based method that returns an array with the correct types already. */ template inline std::vector getObjectsOfType( - const char* pDocName=0, int resolve=1) const; + const char* pDocName=nullptr, int resolve=1) const; /// Visible state used by setVisible() enum VisibleState { @@ -488,7 +488,7 @@ public: * * @return The returned vector reflects the sequence of selection. */ - std::vector getSelection(const char* pDocName=0, int resolve=1, bool single=false) const; + std::vector getSelection(const char* pDocName=nullptr, int resolve=1, bool single=false) const; /** Returns a vector of selection objects * * @param pDocName: document name. If no document name is given the objects @@ -505,7 +505,7 @@ public: * * @return The returned vector reflects the sequence of selection. */ - std::vector getSelectionEx(const char* pDocName=0, + std::vector getSelectionEx(const char* pDocName=nullptr, Base::Type typeId=App::DocumentObject::getClassTypeId(),int resolve=1, bool single=false) const; /** @@ -544,7 +544,7 @@ public: * then sub-object (i.e. a group child object) selection is also counted * even if it selects the whole sub-object. */ - bool hasSubSelection(const char *doc=0, bool subElement=false) const; + bool hasSubSelection(const char *doc=nullptr, bool subElement=false) const; /// Check if there is any pre-selection bool hasPreselection() const; @@ -576,7 +576,7 @@ public: * 2 resolve sub-object with new style element name * @param index: optional position in the stack */ - std::vector selStackGet(const char* pDocName=0,int resolve=1,int index=0) const; + std::vector selStackGet(const char* pDocName=nullptr,int resolve=1,int index=0) const; /** Go back selection history * @@ -622,7 +622,7 @@ public: std::vector getPickedList(const char* pDocName) const; /// Return selected object inside picked list grouped by top level parents std::vector getPickedListEx( - const char* pDocName=0, Base::Type typeId=App::DocumentObject::getClassTypeId()) const; + const char* pDocName=nullptr, Base::Type typeId=App::DocumentObject::getClassTypeId()) const; //@} static SelectionSingleton& instance(void); @@ -669,7 +669,7 @@ protected: void slotDeletedObject(const App::DocumentObject&); /// helper to retrieve document by name - App::Document* getDocument(const char* pDocName=0) const; + App::Document* getDocument(const char* pDocName=nullptr) const; void slotSelectionChanged(const SelectionChanges& msg); @@ -686,15 +686,15 @@ protected: std::string FeatName; std::string SubName; std::string TypeName; - App::Document* pDoc = 0; - App::DocumentObject* pObject = 0; + App::Document* pDoc = nullptr; + App::DocumentObject* pObject = nullptr; float x = 0.0f; float y = 0.0f; float z = 0.0f; bool logged = false; std::pair elementName; - App::DocumentObject* pResolvedObject = 0; + App::DocumentObject* pResolvedObject = nullptr; void log(bool remove=false, bool clearPreselect=true); }; @@ -708,12 +708,12 @@ protected: std::deque _SelStackForward; int checkSelection(const char *pDocName, const char *pObjectName, - const char *pSubName,int resolve, _SelObj &sel, const std::list<_SelObj> *selList=0) const; + const char *pSubName,int resolve, _SelObj &sel, const std::list<_SelObj> *selList=nullptr) const; std::vector getObjectList(const char* pDocName,Base::Type typeId, std::list<_SelObj> &objs, int resolve, bool single=false) const; static App::DocumentObject *getObjectOfType(_SelObj &sel, Base::Type type, - int resolve, const char **subelement=0); + int resolve, const char **subelement=nullptr); static SelectionSingleton* _pcSingleton; diff --git a/src/Gui/SelectionFilter.cpp b/src/Gui/SelectionFilter.cpp index 0e59837fcb..5a43c0b1d0 100644 --- a/src/Gui/SelectionFilter.cpp +++ b/src/Gui/SelectionFilter.cpp @@ -262,14 +262,14 @@ PyObject *SelectionFilterPy::PyMake(struct _typeobject *, PyObject *args, PyObje { char* str; if (!PyArg_ParseTuple(args, "s",&str)) - return 0; + return nullptr; try { SelectionFilter filter(str); return new SelectionFilterPy(filter.getFilter()); } catch (const Base::Exception& e) { PyErr_SetString(PyExc_SyntaxError, e.what()); - return 0; + return nullptr; } } @@ -300,7 +300,7 @@ Py::Object SelectionFilterPy::match(const Py::Tuple& args) Py::Object SelectionFilterPy::test(const Py::Tuple& args) { PyObject * pcObj; - char* text=0; + char* text=nullptr; if (!PyArg_ParseTuple(args.ptr(), "O!|s",&(App::DocumentObjectPy::Type),&pcObj,&text)) throw Py::Exception(); @@ -327,7 +327,7 @@ Py::Object SelectionFilterPy::result(const Py::Tuple&) Py::Object SelectionFilterPy::setFilter(const Py::Tuple& args) { - char* text=0; + char* text=nullptr; if (!PyArg_ParseTuple(args.ptr(), "s",&text)) throw Py::Exception(); try { @@ -343,8 +343,8 @@ Py::Object SelectionFilterPy::setFilter(const Py::Tuple& args) // include the Scanner and the Parser for the filter language -SelectionFilter* ActFilter=0; -Node_Block *TopBlock=0; +SelectionFilter* ActFilter=nullptr; +Node_Block *TopBlock=nullptr; // error func void yyerror(char *errorinfo) @@ -418,9 +418,9 @@ bool SelectionFilter::parse(void) assert(!ActFilter); ActFilter = this; /*int my_parse_result =*/ SelectionParser::yyparse(); - ActFilter = 0; + ActFilter = nullptr; Ast.reset(TopBlock); - TopBlock = 0; + TopBlock = nullptr; SelectionParser::SelectionFilter_delete_buffer (my_string_buffer); SelectionParser::StringFactory::instance()->clear(); diff --git a/src/Gui/SelectionObject.cpp b/src/Gui/SelectionObject.cpp index bedef25563..df1287f272 100644 --- a/src/Gui/SelectionObject.cpp +++ b/src/Gui/SelectionObject.cpp @@ -73,7 +73,7 @@ const App::DocumentObject * SelectionObject::getObject(void) const if (doc && !FeatName.empty()) return doc->getObject(FeatName.c_str()); } - return 0; + return nullptr; } App::DocumentObject * SelectionObject::getObject(void) @@ -83,7 +83,7 @@ App::DocumentObject * SelectionObject::getObject(void) if (doc && !FeatName.empty()) return doc->getObject(FeatName.c_str()); } - return 0; + return nullptr; } bool SelectionObject::isObjectTypeOf(const Base::Type& typeId) const diff --git a/src/Gui/SelectionObjectPyImp.cpp b/src/Gui/SelectionObjectPyImp.cpp index b82b9187e9..cc6343da1a 100644 --- a/src/Gui/SelectionObjectPyImp.cpp +++ b/src/Gui/SelectionObjectPyImp.cpp @@ -46,7 +46,7 @@ std::string SelectionObjectPy::representation(void) const PyObject* SelectionObjectPy::remove(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Selection().rmvSelection(getSelectionObjectPtr()->getDocName(), getSelectionObjectPtr()->getFeatName()); Py_Return; @@ -56,11 +56,11 @@ PyObject* SelectionObjectPy::isObjectTypeOf(PyObject * args) { char* type; if (!PyArg_ParseTuple(args, "s", &type)) - return 0; + return nullptr; Base::Type id = Base::Type::fromName(type); if (id.isBad()) { PyErr_SetString(PyExc_TypeError, "Not a valid type"); - return 0; + return nullptr; } bool ok = getSelectionObjectPtr()->isObjectTypeOf(id); @@ -125,7 +125,7 @@ Py::Tuple SelectionObjectPy::getSubObjects(void) const std::vector subObjs; for(const auto &subname : getSelectionObjectPtr()->getSubNames()) { - PyObject *pyObj=0; + PyObject *pyObj=nullptr; Base::Matrix4D mat; obj->getSubObject(subname.c_str(),&pyObj,&mat); if(pyObj) @@ -159,7 +159,7 @@ Py::Tuple SelectionObjectPy::getPickedPoints(void) const PyObject *SelectionObjectPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SelectionObjectPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index e802dc27ea..84713911f8 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -313,7 +313,7 @@ void SelectionView::validateSearch(void) if (doc) { Gui::Selection().clearSelection(); for (std::vector::iterator it = searchList.begin(); it != searchList.end(); ++it) { - Gui::Selection().addSelection(doc->getName(),(*it)->getNameInDocument(),0); + Gui::Selection().addSelection(doc->getName(),(*it)->getNameInDocument(),nullptr); } } } diff --git a/src/Gui/SelectionView.h b/src/Gui/SelectionView.h index 66b5aa9d16..d73ba2cd8c 100644 --- a/src/Gui/SelectionView.h +++ b/src/Gui/SelectionView.h @@ -51,7 +51,7 @@ public: * A constructor. * A more elaborate description of the constructor. */ - SelectionView(Gui::Document* pcDocument, QWidget *parent=0); + SelectionView(Gui::Document* pcDocument, QWidget *parent=nullptr); /** * A destructor. @@ -85,7 +85,7 @@ public Q_SLOTS: /// get called when the list is right-clicked void onItemContextMenu(const QPoint& point); /// different actions - void select(QListWidgetItem* item=0); + void select(QListWidgetItem* item=nullptr); void deselect(void); void zoom(void); void treeSelect(void); @@ -93,8 +93,8 @@ public Q_SLOTS: void touch(void); void showPart(void); void onEnablePickList(); - void toggleSelect(QListWidgetItem* item=0); - void preselect(QListWidgetItem* item=0); + void toggleSelect(QListWidgetItem* item=nullptr); + void preselect(QListWidgetItem* item=nullptr); protected: void showEvent(QShowEvent *) override; diff --git a/src/Gui/SoFCCSysDragger.cpp b/src/Gui/SoFCCSysDragger.cpp index 1576222076..8983e65992 100644 --- a/src/Gui/SoFCCSysDragger.cpp +++ b/src/Gui/SoFCCSysDragger.cpp @@ -312,13 +312,13 @@ SbBool TDragger::setUpConnections(SbBool onoff, SbBool doitalways) if (onoff) { inherited::setUpConnections(onoff, doitalways); - TDragger::fieldSensorCB(this, NULL); + TDragger::fieldSensorCB(this, nullptr); if (this->fieldSensor.getAttachedField() != &this->translation) this->fieldSensor.attach(&this->translation); } else { - if (this->fieldSensor.getAttachedField() != NULL) + if (this->fieldSensor.getAttachedField() != nullptr) this->fieldSensor.detach(); inherited::setUpConnections(onoff, doitalways); } @@ -597,13 +597,13 @@ SbBool RDragger::setUpConnections(SbBool onoff, SbBool doitalways) if (onoff) { inherited::setUpConnections(onoff, doitalways); - RDragger::fieldSensorCB(this, NULL); + RDragger::fieldSensorCB(this, nullptr); if (this->fieldSensor.getAttachedField() != &this->rotation) this->fieldSensor.attach(&this->rotation); } else { - if (this->fieldSensor.getAttachedField() != NULL) + if (this->fieldSensor.getAttachedField() != nullptr) 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() != NULL) + if (this->translationSensor.getAttachedField() != nullptr) this->translationSensor.detach(); - if (this->rotationSensor.getAttachedField() != NULL) + if (this->rotationSensor.getAttachedField() != nullptr) this->rotationSensor.detach(); } return !(this->connectionsSetUp = onoff); diff --git a/src/Gui/SoFCInteractiveElement.cpp b/src/Gui/SoFCInteractiveElement.cpp index b65ba4800d..dda3b49e45 100644 --- a/src/Gui/SoFCInteractiveElement.cpp +++ b/src/Gui/SoFCInteractiveElement.cpp @@ -84,7 +84,7 @@ void SoGLWidgetElement::initClass(void) void SoGLWidgetElement::init(SoState * state) { inherited::init(state); - this->window = 0; + this->window = nullptr; } SoGLWidgetElement::~SoGLWidgetElement() @@ -122,7 +122,7 @@ SbBool SoGLWidgetElement::matches(const SoElement * /*element*/) const SoElement * SoGLWidgetElement::copyMatchInfo(void) const { - return 0; + return nullptr; } // --------------------------------- @@ -139,7 +139,7 @@ void SoGLRenderActionElement::initClass(void) void SoGLRenderActionElement::init(SoState * state) { inherited::init(state); - this->glRenderAction = 0; + this->glRenderAction = nullptr; } SoGLRenderActionElement::~SoGLRenderActionElement() @@ -177,7 +177,7 @@ SbBool SoGLRenderActionElement::matches(const SoElement * /*element*/) const SoElement * SoGLRenderActionElement::copyMatchInfo(void) const { - return 0; + return nullptr; } // --------------------------------- @@ -187,7 +187,7 @@ SO_NODE_SOURCE(SoGLWidgetNode) /*! Constructor. */ -SoGLWidgetNode::SoGLWidgetNode(void) : window(0) +SoGLWidgetNode::SoGLWidgetNode(void) : window(nullptr) { SO_NODE_CONSTRUCTOR(SoGLWidgetNode); } @@ -281,5 +281,5 @@ SbBool SoGLVBOActivatedElement::matches(const SoElement * /*element*/) const SoElement * SoGLVBOActivatedElement::copyMatchInfo(void) const { - return 0; + return nullptr; } diff --git a/src/Gui/SoFCOffscreenRenderer.cpp b/src/Gui/SoFCOffscreenRenderer.cpp index be4d923140..33cecb0de5 100644 --- a/src/Gui/SoFCOffscreenRenderer.cpp +++ b/src/Gui/SoFCOffscreenRenderer.cpp @@ -62,12 +62,12 @@ void writeJPEGComment(const std::string&, QByteArray&); // --------------------------------------------------------------- -SoFCOffscreenRenderer* SoFCOffscreenRenderer::inst = 0; +SoFCOffscreenRenderer* SoFCOffscreenRenderer::inst = nullptr; SoFCOffscreenRenderer& SoFCOffscreenRenderer::instance() { - if (inst==0) + if (inst==nullptr) inst = new SoFCOffscreenRenderer(SbViewportRegion()); return *inst; } @@ -408,7 +408,7 @@ void SoQtOffscreenRenderer::init(const SbViewportRegion & vpr, this->didallocation = glrenderaction ? false : true; this->viewport = vpr; - this->framebuffer = NULL; + this->framebuffer = nullptr; this->numSamples = -1; //this->texFormat = GL_RGBA32F_ARB; this->texFormat = GL_RGB32F_ARB; @@ -550,7 +550,7 @@ SoQtOffscreenRenderer::makeFrameBuffer(int width, int height, int samples) { if (framebuffer) { delete framebuffer; - framebuffer = NULL; + framebuffer = nullptr; } viewport.setWindowSize(width, height); @@ -608,7 +608,7 @@ SoQtOffscreenRenderer::renderFromBase(SoBase * base) // needed to clear viewport after glViewport() is called from // SoGLRenderAction - this->renderaction->addPreRenderCallback(pre_render_cb, NULL); + this->renderaction->addPreRenderCallback(pre_render_cb, nullptr); this->renderaction->setViewportRegion(this->viewport); if (base->isOfType(SoNode::getClassTypeId())) @@ -619,7 +619,7 @@ SoQtOffscreenRenderer::renderFromBase(SoBase * base) assert(false && "Cannot apply to anything else than an SoNode or an SoPath"); } - this->renderaction->removePreRenderCallback(pre_render_cb, NULL); + this->renderaction->removePreRenderCallback(pre_render_cb, nullptr); framebuffer->release(); this->renderaction->setCacheContext(oldcontext); // restore old diff --git a/src/Gui/SoFCOffscreenRenderer.h b/src/Gui/SoFCOffscreenRenderer.h index 36b35c55f9..adc1d77c40 100644 --- a/src/Gui/SoFCOffscreenRenderer.h +++ b/src/Gui/SoFCOffscreenRenderer.h @@ -128,7 +128,7 @@ public: QStringList getWriteImageFiletypeInfo() const; private: - void init(const SbViewportRegion & vpr, SoGLRenderAction * glrenderaction = NULL); + void init(const SbViewportRegion & vpr, SoGLRenderAction * glrenderaction = nullptr); static void pre_render_cb(void * userdata, SoGLRenderAction * action); SbBool renderFromBase(SoBase * base); void makeFrameBuffer(int width, int height, int samples); diff --git a/src/Gui/SoFCSelection.cpp b/src/Gui/SoFCSelection.cpp index 11f42454e7..da112473da 100644 --- a/src/Gui/SoFCSelection.cpp +++ b/src/Gui/SoFCSelection.cpp @@ -65,7 +65,7 @@ namespace Gui { std::array,3 > schemaTranslatePoint(double x, double y, double z, double precision); } -SoFullPath * Gui::SoFCSelection::currenthighlight = NULL; +SoFullPath * Gui::SoFCSelection::currenthighlight = nullptr; // ************************************************************************* @@ -126,10 +126,10 @@ SoFCSelection::~SoFCSelection() { // If we're being deleted and we're the current highlight, // NULL out that variable - if (currenthighlight != NULL && + if (currenthighlight != nullptr && (!currenthighlight->getTail()->isOfType(SoFCSelection::getClassTypeId()))) { currenthighlight->unref(); - currenthighlight = NULL; + currenthighlight = nullptr; } //delete THIS; } @@ -324,7 +324,7 @@ SoFCSelection::getPickedPoint(SoHandleEventAction* action) const // almost similar coordinates we use the second point, instead. const SoPickedPointList & points = action->getPickedPointList(); if (points.getLength() == 0) - return 0; + return nullptr; else if (points.getLength() == 1) return points[0]; //const SoPickedPoint* pp0 = points[0]; @@ -485,7 +485,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) Gui::Selection().clearSelection(documentName.getValue().getString()); Gui::Selection().addSelection(documentName.getValue().getString() ,objectName.getValue().getString() - ,0 ,pt[0] ,pt[1] ,pt[2]); + ,nullptr ,pt[0] ,pt[1] ,pt[2]); } if (mymode == OFF) { @@ -1024,7 +1024,7 @@ SoFCSelection::turnoffcurrent(SoAction * action) } if (SoFCSelection::currenthighlight) { SoFCSelection::currenthighlight->unref(); - SoFCSelection::currenthighlight = NULL; + SoFCSelection::currenthighlight = nullptr; } #else if (currenthighlight == NULL) @@ -1053,7 +1053,7 @@ SoFCSelection::isHighlighted(SoAction *action) //////////////////////////////////////////////////////////////////////// { SoFullPath *actionPath = (SoFullPath *) action->getCurPath(); - return (currenthighlight != NULL && + return (currenthighlight != nullptr && currenthighlight->getTail() == actionPath->getTail() && // nested SoHL! *currenthighlight == *actionPath); } diff --git a/src/Gui/SoFCSelectionAction.cpp b/src/Gui/SoFCSelectionAction.cpp index a80ab41f27..98a24c8b8e 100644 --- a/src/Gui/SoFCSelectionAction.cpp +++ b/src/Gui/SoFCSelectionAction.cpp @@ -952,17 +952,17 @@ class SoBoxSelectionRenderActionP { public: SoBoxSelectionRenderActionP(SoBoxSelectionRenderAction * master) : master(master) - , searchaction(0) - , selectsearch(0) - , camerasearch(0) - , bboxaction(0) - , basecolor(0) - , postprocpath(0) - , highlightPath(0) - , localRoot(0) - , xform(0) - , cube(0) - , drawstyle(0) + , searchaction(nullptr) + , selectsearch(nullptr) + , camerasearch(nullptr) + , bboxaction(nullptr) + , basecolor(nullptr) + , postprocpath(nullptr) + , highlightPath(nullptr) + , localRoot(nullptr) + , xform(nullptr) + , cube(nullptr) + , drawstyle(nullptr) { } @@ -1030,7 +1030,7 @@ SoBoxSelectionRenderActionP::initBoxGraph() void SoBoxSelectionRenderActionP::updateBbox(const SoPath * path) { - if (this->camerasearch == NULL) { + if (this->camerasearch == nullptr) { this->camerasearch = new SoSearchAction; } @@ -1047,7 +1047,7 @@ SoBoxSelectionRenderActionP::updateBbox(const SoPath * path) this->localRoot->insertChild(this->camerasearch->getPath()->getTail(), 0); this->camerasearch->reset(); - if (this->bboxaction == NULL) { + if (this->bboxaction == nullptr) { this->bboxaction = new SoGetBoundingBoxAction(SbViewportRegion(100, 100)); } this->bboxaction->setViewportRegion(PUBLIC(this)->getViewportRegion()); @@ -1122,15 +1122,15 @@ SoBoxSelectionRenderAction::constructorCommon(void) PRIVATE(this)->basecolor->rgb.setValue(1.0f, 0.0f, 0.0f); PRIVATE(this)->drawstyle->linePattern = 0xffff; PRIVATE(this)->drawstyle->lineWidth = 1.0f; - PRIVATE(this)->searchaction = NULL; - PRIVATE(this)->selectsearch = NULL; - PRIVATE(this)->camerasearch = NULL; - PRIVATE(this)->bboxaction = NULL; + PRIVATE(this)->searchaction = nullptr; + PRIVATE(this)->selectsearch = nullptr; + PRIVATE(this)->camerasearch = nullptr; + PRIVATE(this)->bboxaction = nullptr; // SoBase-derived objects should be dynamically allocated. PRIVATE(this)->postprocpath = new SoTempPath(32); PRIVATE(this)->postprocpath->ref(); - PRIVATE(this)->highlightPath = 0; + PRIVATE(this)->highlightPath = nullptr; } SoBoxSelectionRenderAction::~SoBoxSelectionRenderAction(void) @@ -1154,7 +1154,7 @@ SoBoxSelectionRenderAction::apply(SoNode * node) { SoGLRenderAction::apply(node); if (this->hlVisible) { - if (PRIVATE(this)->searchaction == NULL) { + if (PRIVATE(this)->searchaction == nullptr) { PRIVATE(this)->searchaction = new SoSearchAction; } PRIVATE(this)->searchaction->setType(SoFCSelection::getClassTypeId()); @@ -1169,7 +1169,7 @@ SoBoxSelectionRenderAction::apply(SoNode * node) assert(selection->getTypeId().isDerivedFrom(SoFCSelection::getClassTypeId())); if (selection->selected.getValue() && selection->style.getValue() == SoFCSelection::BOX) { PRIVATE(this)->basecolor->rgb.setValue(selection->colorSelection.getValue()); - if (PRIVATE(this)->selectsearch == NULL) { + if (PRIVATE(this)->selectsearch == nullptr) { PRIVATE(this)->selectsearch = new SoSearchAction; } PRIVATE(this)->selectsearch->setType(SoShape::getClassTypeId()); @@ -1188,7 +1188,7 @@ SoBoxSelectionRenderAction::apply(SoNode * node) selection->style.getValue() == SoFCSelection::BOX) { PRIVATE(this)->basecolor->rgb.setValue(selection->colorHighlight.getValue()); - if (PRIVATE(this)->selectsearch == NULL) { + if (PRIVATE(this)->selectsearch == nullptr) { PRIVATE(this)->selectsearch = new SoSearchAction; } PRIVATE(this)->selectsearch->setType(SoShape::getClassTypeId()); @@ -1225,7 +1225,7 @@ SoBoxSelectionRenderAction::apply(SoPath * path) // This happens when dehighlighting the current shape if (PRIVATE(this)->highlightPath == path) { PRIVATE(this)->highlightPath->unref(); - PRIVATE(this)->highlightPath = 0; + PRIVATE(this)->highlightPath = nullptr; // FIXME: Doing a redraw to remove the shown bounding box causes // some problems when moving the mouse from one shape to another // because this will destroy the box immediately @@ -1236,7 +1236,7 @@ SoBoxSelectionRenderAction::apply(SoPath * path) selection->style.getValue() == SoFCSelection::BOX) { PRIVATE(this)->basecolor->rgb.setValue(selection->colorHighlight.getValue()); - if (PRIVATE(this)->selectsearch == NULL) { + if (PRIVATE(this)->selectsearch == nullptr) { PRIVATE(this)->selectsearch = new SoSearchAction; } PRIVATE(this)->selectsearch->setType(SoShape::getClassTypeId()); diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 30135e4412..d8321cc854 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -93,7 +93,7 @@ namespace Gui { std::array,3 > schemaTranslatePoint(double x, double y, double z, double precision); } -SoFullPath * Gui::SoFCUnifiedSelection::currenthighlight = NULL; +SoFullPath * Gui::SoFCUnifiedSelection::currenthighlight = nullptr; // ************************************************************************* @@ -102,7 +102,7 @@ SO_NODE_SOURCE(SoFCUnifiedSelection) /*! Constructor. */ -SoFCUnifiedSelection::SoFCUnifiedSelection() : pcDocument(0) +SoFCUnifiedSelection::SoFCUnifiedSelection() : pcDocument(nullptr) { SO_NODE_CONSTRUCTOR(SoFCUnifiedSelection); @@ -137,13 +137,13 @@ SoFCUnifiedSelection::~SoFCUnifiedSelection() { // If we're being deleted and we're the current highlight, // NULL out that variable - if (currenthighlight != NULL) { + if (currenthighlight != nullptr) { currenthighlight->unref(); - currenthighlight = NULL; + currenthighlight = nullptr; } if (detailPath) { detailPath->unref(); - detailPath = NULL; + detailPath = nullptr; } } @@ -160,7 +160,7 @@ void SoFCUnifiedSelection::finish() } bool SoFCUnifiedSelection::hasHighlight() { - return currenthighlight != NULL; + return currenthighlight != nullptr; } void SoFCUnifiedSelection::applySettings() @@ -226,14 +226,14 @@ int SoFCUnifiedSelection::getPriority(const SoPickedPoint* p) std::vector SoFCUnifiedSelection::getPickedList(SoHandleEventAction* action, bool singlePick) const { - ViewProvider *last_vp = 0; + ViewProvider *last_vp = nullptr; std::vector ret; const SoPickedPointList & points = action->getPickedPointList(); for(int i=0,count=points.getLength();i(info.pp->getPath()); if (this->pcDocument && path && path->containsPath(action->getCurPath())) { vp = this->pcDocument->getViewProviderByPathFromHead(path); @@ -250,7 +250,7 @@ SoFCUnifiedSelection::getPickedList(SoHandleEventAction* action, bool singlePick if(!(useNewSelection.getValue()||info.vpd->useNewSelectionModel()) || !info.vpd->isSelectable()) { if(!singlePick) continue; if(ret.empty()) { - info.vpd = 0; + info.vpd = nullptr; ret.push_back(info); } break; @@ -337,7 +337,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) SoHighlightElementAction hlAction; hlAction.apply(currenthighlight); currenthighlight->unref(); - currenthighlight = 0; + currenthighlight = nullptr; } } else if (highlightMode.getValue() != OFF @@ -346,7 +346,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) SoHighlightElementAction hlAction; hlAction.apply(currenthighlight); currenthighlight->unref(); - currenthighlight = 0; + currenthighlight = nullptr; } App::Document* doc = App::GetApplication().getDocument(hilaction->SelChange.pDocName); @@ -448,7 +448,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) (useNewSelection.getValue()||vp->useNewSelectionModel()) && vp->isSelectable()) { detailPath->truncate(0); - SoDetail *det = 0; + SoDetail *det = nullptr; if(vp->getDetailPath(selaction->SelChange.pSubName,detailPath,true,det)) { setHighlight(detailPath,det,static_cast(vp), selaction->SelChange.pSubName, @@ -469,7 +469,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) bool SoFCUnifiedSelection::setHighlight(const PickedInfo &info) { if(!info.pp) - return setHighlight(0,0,0,0,0.0,0.0,0.0); + return setHighlight(nullptr,nullptr,nullptr,nullptr,0.0,0.0,0.0); const auto &pt = info.pp->getPoint(); return setHighlight(static_cast(info.pp->getPath()), info.pp->getDetail(), info.vpd, info.element.c_str(), pt[0],pt[1],pt[2]); @@ -509,7 +509,7 @@ bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det, action.setHighlighted(false); action.apply(currenthighlight); currenthighlight->unref(); - currenthighlight = 0; + currenthighlight = nullptr; } currenthighlight = static_cast(path->copy()); currenthighlight->ref(); @@ -525,7 +525,7 @@ bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det, action.apply(currenthighlight); if(!highlighted) { currenthighlight->unref(); - currenthighlight = 0; + currenthighlight = nullptr; Selection().rmvPreselect(); } this->touch(); @@ -567,7 +567,7 @@ bool SoFCUnifiedSelection::setSelection(const std::vector &infos, bo bool hasNext = false; const SoPickedPoint * pp = info.pp; const SoDetail *det = pp->getDetail(); - SoDetail *detNext = 0; + SoDetail *detNext = nullptr; SoFullPath *pPath = static_cast(pp->getPath()); const auto &pt = pp->getPoint(); SoSelectionElementAction::Type type = SoSelectionElementAction::None; @@ -780,7 +780,7 @@ void SoFCUnifiedSelection::GLRenderBelowPath(SoGLRenderAction * action) QtGLWidget* window; SoState *state = action->getState(); SoGLWidgetElement::get(state, window); - QWidget* parent = window ? window->parentWidget() : 0; + QWidget* parent = window ? window->parentWidget() : nullptr; if (parent) { QCursor c = parent->cursor(); if (c.shape() == Qt::ForbiddenCursor) { @@ -811,7 +811,7 @@ void SoHighlightElementAction::initClass() SO_ACTION_ADD_METHOD(SoPointSet,callDoAction); } -SoHighlightElementAction::SoHighlightElementAction () : _highlight(false), _det(0) +SoHighlightElementAction::SoHighlightElementAction () : _highlight(false), _det(nullptr) { SO_ACTION_CONSTRUCTOR(SoHighlightElementAction); } @@ -882,7 +882,7 @@ void SoSelectionElementAction::initClass() } SoSelectionElementAction::SoSelectionElementAction (Type t, bool secondary) - : _type(t), _det(0), _secondary(secondary) + : _type(t), _det(nullptr), _secondary(secondary) { SO_ACTION_CONSTRUCTOR(SoSelectionElementAction); } @@ -1056,9 +1056,9 @@ typedef struct { static void so_bbox_construct_data(void * closure) { SoFCBBoxRenderInfo * data = (SoFCBBoxRenderInfo*) closure; - data->bboxaction = NULL; - data->cube = NULL; - data->packer = NULL; + data->bboxaction = nullptr; + data->cube = nullptr; + data->packer = nullptr; } static void so_bbox_destruct_data(void * closure) @@ -1070,7 +1070,7 @@ static void so_bbox_destruct_data(void * closure) delete data->packer; } -static SbStorage * so_bbox_storage = NULL; +static SbStorage * so_bbox_storage = nullptr; // called from atexit static void so_bbox_cleanup(void) @@ -1161,7 +1161,7 @@ SoFCSelectionRoot::getNodeContext2(Stack &stack, SoNode *node, SoFCSelectionCont SoFCSelectionContextBasePtr ctx; if(it!=map.end()) ctx = it->second; - status = merge(status,ret,ctx,stack.offset==stack.size()-1?0:stack[stack.offset]); + status = merge(status,ret,ctx,stack.offset==stack.size()-1?nullptr:stack[stack.offset]); if(status<0) break; } @@ -1220,7 +1220,7 @@ std::pair SoFCSelectionRoot::findActionContex bool SoFCSelectionRoot::renderBBox(SoGLRenderAction *action, SoNode *node, SbColor color) { auto data = (SoFCBBoxRenderInfo*) so_bbox_storage->get(); - if (data->bboxaction == NULL) { + if (data->bboxaction == nullptr) { // The viewport region will be replaced every time the action is // used, so we can just feed it a dummy here. data->bboxaction = new SoGetBoundingBoxAction(SbViewportRegion()); @@ -1272,7 +1272,7 @@ void SoFCSelectionRoot::renderPrivate(SoGLRenderAction * action, bool inPath) { if(ViewParams::instance()->getCoinCycleCheck() && !SelStack.nodeSet.insert(this).second) { - std::time_t t = std::time(0); + std::time_t t = std::time(nullptr); if(_CyclicLastReported < t) { _CyclicLastReported = t+5; FC_ERR("Cyclic scene graph: " << getName()); @@ -1386,7 +1386,7 @@ bool SoFCSelectionRoot::_renderPrivate(SoGLRenderAction * action, bool inPath) { } if(colorPushed) { - ShapeColorNode = 0; + ShapeColorNode = nullptr; state->pop(); } @@ -1684,9 +1684,9 @@ SO_NODE_SOURCE(SoFCPathAnnotation) SoFCPathAnnotation::SoFCPathAnnotation() { SO_NODE_CONSTRUCTOR(SoFCPathAnnotation); - path = 0; - tmpPath = 0; - det = 0; + path = nullptr; + tmpPath = nullptr; + det = nullptr; } SoFCPathAnnotation::~SoFCPathAnnotation() @@ -1740,7 +1740,7 @@ void SoFCPathAnnotation::GLRenderBelowPath(SoGLRenderAction * action) } } tmpPath->unref(); - tmpPath = 0; + tmpPath = nullptr; return; } } @@ -1809,10 +1809,10 @@ void SoFCPathAnnotation::setPath(SoPath *newPath) { if(path) { path->unref(); coinRemoveAllChildren(this); - path = 0; + path = nullptr; if(tmpPath) { tmpPath->unref(); - tmpPath = 0; + tmpPath = nullptr; } } if(!newPath || !newPath->getLength()) diff --git a/src/Gui/SoFCUnifiedSelection.h b/src/Gui/SoFCUnifiedSelection.h index 854044ed96..38b33974d8 100644 --- a/src/Gui/SoFCUnifiedSelection.h +++ b/src/Gui/SoFCUnifiedSelection.h @@ -107,7 +107,7 @@ private: const SoPickedPoint *pp; ViewProviderDocumentObject *vpd; std::string element; - PickedInfo():pp(0),vpd(0) + PickedInfo():pp(nullptr),vpd(nullptr) {} }; diff --git a/src/Gui/SoFCVectorizeSVGAction.cpp b/src/Gui/SoFCVectorizeSVGAction.cpp index 7a1a5c17e4..9e14fe955e 100644 --- a/src/Gui/SoFCVectorizeSVGAction.cpp +++ b/src/Gui/SoFCVectorizeSVGAction.cpp @@ -121,7 +121,7 @@ class SoVectorizeImage : public SoVectorizeItem { public: SoVectorizeImage(void) { this->type = IMAGE; - this->image.data = 0; + this->image.data = nullptr; this->image.nc = 0; } diff --git a/src/Gui/SoFCVectorizeU3DAction.cpp b/src/Gui/SoFCVectorizeU3DAction.cpp index 51ac1c4e6a..2c786e9117 100644 --- a/src/Gui/SoFCVectorizeU3DAction.cpp +++ b/src/Gui/SoFCVectorizeU3DAction.cpp @@ -122,7 +122,7 @@ class SoVectorizeImage : public SoVectorizeItem { public: SoVectorizeImage(void) { this->type = IMAGE; - this->image.data = 0; + this->image.data = nullptr; this->image.nc = 0; } diff --git a/src/Gui/SoNavigationDragger.cpp b/src/Gui/SoNavigationDragger.cpp index 153267f444..75ac8715cc 100644 --- a/src/Gui/SoNavigationDragger.cpp +++ b/src/Gui/SoNavigationDragger.cpp @@ -165,9 +165,9 @@ RotTransDragger::RotTransDragger() RotTransDragger::~RotTransDragger() { - if (rotFieldSensor!=NULL) + if (rotFieldSensor!=nullptr) delete rotFieldSensor; - if (translFieldSensor!=NULL) + if (translFieldSensor!=nullptr) delete translFieldSensor; } @@ -269,7 +269,7 @@ RotTransDragger::setUpConnections(SbBool onOff, SbBool doItAlways) // Call the sensor CB to make things up-to-date. - fieldSensorCB(this, NULL); + fieldSensorCB(this, nullptr); // Connect the field sensors if (translFieldSensor->getAttachedField() != &translation) @@ -315,9 +315,9 @@ RotTransDragger::setUpConnections(SbBool onOff, SbBool doItAlways) unregisterChildDragger(ZD); // Disconnect the field sensors. - if (translFieldSensor->getAttachedField()!=NULL) + if (translFieldSensor->getAttachedField()!=nullptr) translFieldSensor->detach(); - if (rotFieldSensor->getAttachedField()!=NULL) + if (rotFieldSensor->getAttachedField()!=nullptr) rotFieldSensor->detach(); SoDragger::setUpConnections(onOff, doItAlways); @@ -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 != NULL) + if (mySS != nullptr) mySS->invalidate(); } diff --git a/src/Gui/SoTouchEvents.cpp b/src/Gui/SoTouchEvents.cpp index eb777a5a7a..e4a98f036f 100644 --- a/src/Gui/SoTouchEvents.cpp +++ b/src/Gui/SoTouchEvents.cpp @@ -200,5 +200,5 @@ const SoEvent* GesturesDevice::translateEvent(QEvent* event) return new SoGesturePanEvent(pg,this->widget); } } - return 0; + return nullptr; } diff --git a/src/Gui/SpinBox.cpp b/src/Gui/SpinBox.cpp index 39e9255980..6866dbddcd 100644 --- a/src/Gui/SpinBox.cpp +++ b/src/Gui/SpinBox.cpp @@ -171,7 +171,7 @@ void ExpressionSpinBox::openFormulaDialog() PropertyQuantity * qprop = freecad_dynamic_cast(getPath().getProperty()); Unit unit; - if (qprop != 0) + if (qprop != nullptr) unit = qprop->getUnit(); Gui::Dialog::DlgExpressionInput* box = new Gui::Dialog::DlgExpressionInput(getPath(), getExpression(), unit, spinbox); @@ -275,7 +275,7 @@ class UIntSpinBoxPrivate public: UnsignedValidator * mValidator; - UIntSpinBoxPrivate() : mValidator(0) + UIntSpinBoxPrivate() : mValidator(nullptr) { } uint mapToUInt( int v ) const @@ -324,7 +324,7 @@ UIntSpinBox::UIntSpinBox (QWidget* parent) UIntSpinBox::~UIntSpinBox() { delete d->mValidator; - delete d; d = 0; + delete d; d = nullptr; } void UIntSpinBox::setRange(uint minVal, uint maxVal) diff --git a/src/Gui/SpinBox.h b/src/Gui/SpinBox.h index b7e3c793e9..976e0549d1 100644 --- a/src/Gui/SpinBox.h +++ b/src/Gui/SpinBox.h @@ -115,7 +115,7 @@ class GuiExport UIntSpinBox : public QSpinBox, public ExpressionSpinBox Q_OVERRIDE( uint value READ value WRITE setValue ) public: - UIntSpinBox ( QWidget* parent=0 ); + UIntSpinBox ( QWidget* parent=nullptr ); virtual ~UIntSpinBox(); void setRange( uint minVal, uint maxVal ); @@ -162,7 +162,7 @@ class GuiExport IntSpinBox : public QSpinBox, public ExpressionSpinBox Q_OBJECT public: - IntSpinBox ( QWidget* parent=0 ); + IntSpinBox ( QWidget* parent=nullptr ); virtual ~IntSpinBox(); bool apply(const std::string &propName); @@ -184,7 +184,7 @@ class GuiExport DoubleSpinBox : public QDoubleSpinBox, public ExpressionSpinBox Q_OBJECT public: - DoubleSpinBox ( QWidget* parent=0 ); + DoubleSpinBox ( QWidget* parent=nullptr ); virtual ~DoubleSpinBox(); bool apply(const std::string &propName); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 8b8645f19a..63733a0777 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -61,7 +61,7 @@ namespace Gui { class SplashObserver : public Base::ILogger { public: - SplashObserver(QSplashScreen* splasher=0) + SplashObserver(QSplashScreen* splasher=nullptr) : splash(splasher), alignment(Qt::AlignBottom|Qt::AlignLeft), textColor(Qt::black) { Base::Console().AttachObserver(this); @@ -176,7 +176,7 @@ void SplashScreen::drawContents ( QPainter * painter ) // ------------------------------------------------------------------------------ -AboutDialogFactory* AboutDialogFactory::factory = 0; +AboutDialogFactory* AboutDialogFactory::factory = nullptr; AboutDialogFactory::~AboutDialogFactory() { @@ -774,7 +774,7 @@ void AboutDialog::on_copyButton_clicked() /* TRANSLATOR Gui::LicenseView */ LicenseView::LicenseView(QWidget* parent) - : MDIView(0,parent,Qt::WindowFlags()) + : MDIView(nullptr,parent,Qt::WindowFlags()) { browser = new QTextBrowser(this); browser->setOpenExternalLinks(true); diff --git a/src/Gui/Splashscreen.h b/src/Gui/Splashscreen.h index 0425db235c..076242d793 100644 --- a/src/Gui/Splashscreen.h +++ b/src/Gui/Splashscreen.h @@ -74,7 +74,7 @@ class GuiExport LicenseView : public Gui::MDIView Q_OBJECT public: - LicenseView(QWidget* parent=0); + LicenseView(QWidget* parent=nullptr); virtual ~LicenseView(); void setSource(const QUrl & url); @@ -95,7 +95,7 @@ class GuiExport AboutDialog : public QDialog Q_OBJECT public: - AboutDialog(bool showLic, QWidget* parent = 0); + AboutDialog(bool showLic, QWidget* parent = nullptr); ~AboutDialog(); protected: diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index bea46bceb6..51c424f0f1 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -67,7 +67,7 @@ AbstractSplitView::~AbstractSplitView() void AbstractSplitView::deleteSelf() { for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) { - (*it)->setSceneGraph(0); + (*it)->setSceneGraph(nullptr); } MDIView::deleteSelf(); } @@ -124,7 +124,7 @@ void AbstractSplitView::setupSettings() View3DInventorViewer* AbstractSplitView::getViewer(unsigned int n) const { - return (_viewer.size() > n ? _viewer[n] : 0); + return (_viewer.size() > n ? _viewer[n] : nullptr); } /// Observer message from the ParameterGrp @@ -531,7 +531,7 @@ Py::Object AbstractSplitViewPy::fitAll(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewFit", 0); + getSplitViewPtr()->onMsg("ViewFit", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -551,7 +551,7 @@ Py::Object AbstractSplitViewPy::viewBottom(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewBottom", 0); + getSplitViewPtr()->onMsg("ViewBottom", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -572,7 +572,7 @@ Py::Object AbstractSplitViewPy::viewFront(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewFront", 0); + getSplitViewPtr()->onMsg("ViewFront", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -593,7 +593,7 @@ Py::Object AbstractSplitViewPy::viewLeft(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewLeft", 0); + getSplitViewPtr()->onMsg("ViewLeft", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -614,7 +614,7 @@ Py::Object AbstractSplitViewPy::viewRear(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewRear", 0); + getSplitViewPtr()->onMsg("ViewRear", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -635,7 +635,7 @@ Py::Object AbstractSplitViewPy::viewRight(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewRight", 0); + getSplitViewPtr()->onMsg("ViewRight", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -656,7 +656,7 @@ Py::Object AbstractSplitViewPy::viewTop(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewTop", 0); + getSplitViewPtr()->onMsg("ViewTop", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -677,7 +677,7 @@ Py::Object AbstractSplitViewPy::viewIsometric(const Py::Tuple& args) throw Py::Exception(); try { - getSplitViewPtr()->onMsg("ViewAxo", 0); + getSplitViewPtr()->onMsg("ViewAxo", nullptr); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -776,7 +776,7 @@ SplitView3DInventor::SplitView3DInventor(int views, Gui::Document* pcDocument, Q while (views < 2) views ++; - QSplitter* mainSplitter = 0; + QSplitter* mainSplitter = nullptr; // if views < 3 show them as a row if (views <= 3) { diff --git a/src/Gui/TaskCSysDragger.cpp b/src/Gui/TaskCSysDragger.cpp index ff8ccb9a82..269a2a2e43 100644 --- a/src/Gui/TaskCSysDragger.cpp +++ b/src/Gui/TaskCSysDragger.cpp @@ -71,7 +71,7 @@ void TaskCSysDragger::setupGui() { Gui::TaskView::TaskBox *incrementsBox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("button_valid"), - tr("Increments"), true, 0); + tr("Increments"), true, nullptr); QGridLayout *gridLayout = new QGridLayout(); gridLayout->setColumnStretch(1, 1); diff --git a/src/Gui/TaskDlgRelocation.h b/src/Gui/TaskDlgRelocation.h index 33fccdcea0..7b871b6002 100644 --- a/src/Gui/TaskDlgRelocation.h +++ b/src/Gui/TaskDlgRelocation.h @@ -38,7 +38,7 @@ class TaskBoxPosition : public Gui::TaskView::TaskBox Q_OBJECT public: - TaskBoxPosition(QWidget *parent = 0); + TaskBoxPosition(QWidget *parent = nullptr); ~TaskBoxPosition(); @@ -56,7 +56,7 @@ class TaskBoxAngle : public Gui::TaskView::TaskBox Q_OBJECT public: - TaskBoxAngle(QWidget *parent = 0); + TaskBoxAngle(QWidget *parent = nullptr); ~TaskBoxAngle(); diff --git a/src/Gui/TaskElementColors.cpp b/src/Gui/TaskElementColors.cpp index 6e423f5926..9a4c5c3c9d 100644 --- a/src/Gui/TaskElementColors.cpp +++ b/src/Gui/TaskElementColors.cpp @@ -445,14 +445,14 @@ void ElementColors::on_removeAll_clicked() bool ElementColors::accept() { d->accept(); - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); return true; } bool ElementColors::reject() { d->reset(); - Application::Instance->setEditDocument(0); + Application::Instance->setEditDocument(nullptr); return true; } @@ -508,7 +508,7 @@ TaskElementColors::TaskElementColors(ViewProviderDocumentObject* vp, bool noHide { widget = new ElementColors(vp,noHide); taskbox = new TaskView::TaskBox( - QPixmap(), widget->windowTitle(), true, 0); + QPixmap(), widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Gui/TaskView/TaskAppearance.h b/src/Gui/TaskView/TaskAppearance.h index 603e42a098..f67e8b7441 100644 --- a/src/Gui/TaskView/TaskAppearance.h +++ b/src/Gui/TaskView/TaskAppearance.h @@ -45,7 +45,7 @@ class TaskAppearance : public TaskBox, public Gui::SelectionSingleton::ObserverT Q_OBJECT public: - TaskAppearance(QWidget *parent = 0); + TaskAppearance(QWidget *parent = nullptr); ~TaskAppearance(); /// Observer message from the Selection void OnChange(Gui::SelectionSingleton::SubjectType &rCaller, diff --git a/src/Gui/TaskView/TaskDialogPython.cpp b/src/Gui/TaskView/TaskDialogPython.cpp index bf828b2bd9..dd4643f3cf 100644 --- a/src/Gui/TaskView/TaskDialogPython.cpp +++ b/src/Gui/TaskView/TaskDialogPython.cpp @@ -43,7 +43,7 @@ using namespace Gui; using namespace Gui::TaskView; -ControlPy* ControlPy::instance = 0; +ControlPy* ControlPy::instance = nullptr; ControlPy* ControlPy::getInstance() { @@ -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!=0); + return Py::Boolean(dlg!=nullptr); } Py::Object ControlPy::closeDialog(const Py::Tuple& args) @@ -211,7 +211,7 @@ Py::Object ControlPy::showModelView(const Py::Tuple& args) // ------------------------------------------------------------------ TaskWatcherPython::TaskWatcherPython(const Py::Object& o) - : TaskWatcher(0), watcher(o) + : TaskWatcher(nullptr), watcher(o) { QString title; if (watcher.hasAttr(std::string("title"))) { @@ -227,9 +227,9 @@ TaskWatcherPython::TaskWatcherPython(const Py::Object& o) icon = BitmapFactory().pixmap(s.c_str()); } - Gui::TaskView::TaskBox *tb = 0; + Gui::TaskView::TaskBox *tb = nullptr; if (watcher.hasAttr(std::string("commands"))) { - tb = new Gui::TaskView::TaskBox(icon, title, true, 0); + tb = new Gui::TaskView::TaskBox(icon, title, true, nullptr); Py::Sequence cmds(watcher.getAttr(std::string("commands"))); CommandManager &mgr = Gui::Application::Instance->commandManager(); for (Py::Sequence::iterator it = cmds.begin(); it != cmds.end(); ++it) { @@ -243,7 +243,7 @@ TaskWatcherPython::TaskWatcherPython(const Py::Object& o) if (watcher.hasAttr(std::string("widgets"))) { if (!tb && !title.isEmpty()) - tb = new Gui::TaskView::TaskBox(icon, title, true, 0); + tb = new Gui::TaskView::TaskBox(icon, title, true, nullptr); Py::Sequence list(watcher.getAttr(std::string("widgets"))); Gui::PythonWrapper wrap; @@ -317,13 +317,13 @@ TaskDialogPython::TaskDialogPython(const Py::Object& o) : dlg(o) fn = QString::fromUtf8(path.c_str()); QFile file(fn); - QWidget* form = 0; + QWidget* form = nullptr; if (file.open(QFile::ReadOnly)) - form = loader.load(&file, 0); + form = loader.load(&file, nullptr); file.close(); if (form) { Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox( - QPixmap(icon), form->windowTitle(), true, 0); + QPixmap(icon), form->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(form); Content.push_back(taskbox); } @@ -350,7 +350,7 @@ TaskDialogPython::TaskDialogPython(const Py::Object& o) : dlg(o) QWidget* form = qobject_cast(object); if (form) { Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox( - form->windowIcon().pixmap(32), form->windowTitle(), true, 0); + form->windowIcon().pixmap(32), form->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(form); Content.push_back(taskbox); } diff --git a/src/Gui/TaskView/TaskEditControl.h b/src/Gui/TaskView/TaskEditControl.h index a8d3364c56..f0997673d2 100644 --- a/src/Gui/TaskView/TaskEditControl.h +++ b/src/Gui/TaskView/TaskEditControl.h @@ -46,7 +46,7 @@ class TaskEditControl : public TaskWidget Q_OBJECT public: - TaskEditControl(QWidget *parent = 0); + TaskEditControl(QWidget *parent = nullptr); ~TaskEditControl(); QDialogButtonBox* standardButtons() const; friend class TaskView; diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.cpp b/src/Gui/TaskView/TaskSelectLinkProperty.cpp index a239a7acf2..376c34e074 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.cpp +++ b/src/Gui/TaskView/TaskSelectLinkProperty.cpp @@ -38,7 +38,7 @@ using namespace Gui::TaskView; /* TRANSLATOR Gui::TaskView::TaskSelectLinkProperty */ TaskSelectLinkProperty::TaskSelectLinkProperty(const char *sFilter,App::Property *prop,QWidget *parent) - : TaskBox(Gui::BitmapFactory().pixmap("mouse_pointer"),tr("edit selection"),true, parent),Filter(0),LinkSub(0),LinkList(0) + : TaskBox(Gui::BitmapFactory().pixmap("mouse_pointer"),tr("edit selection"),true, parent),Filter(nullptr),LinkSub(nullptr),LinkList(nullptr) { // we need a separate container widget to add all controls to proxy = new QWidget(this); @@ -63,7 +63,7 @@ TaskSelectLinkProperty::TaskSelectLinkProperty(const char *sFilter,App::Property // property have to be set! assert(prop); - StartObject = 0; + StartObject = nullptr; if (prop->getTypeId().isDerivedFrom(App::PropertyLinkSub::getClassTypeId())) { LinkSub = dynamic_cast(prop); } diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.h b/src/Gui/TaskView/TaskSelectLinkProperty.h index e3614addff..2abd6aa0fb 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.h +++ b/src/Gui/TaskView/TaskSelectLinkProperty.h @@ -56,7 +56,7 @@ class GuiExport TaskSelectLinkProperty : public TaskBox, public Gui::SelectionSi Q_OBJECT public: - TaskSelectLinkProperty(const char *,App::Property *,QWidget *parent = 0); + TaskSelectLinkProperty(const char *,App::Property *,QWidget *parent = nullptr); ~TaskSelectLinkProperty(); /// Observer message from the Selection void OnChange(Gui::SelectionSingleton::SubjectType &rCaller, diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 71dee6e116..1d2b1c803e 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -273,7 +273,7 @@ QSize TaskPanel::minimumSizeHint() const //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TaskView::TaskView(QWidget *parent) - : QScrollArea(parent),ActiveDialog(0),ActiveCtrl(0) + : QScrollArea(parent),ActiveDialog(nullptr),ActiveCtrl(nullptr) { //addWidget(new TaskEditControl(this)); //addWidget(new TaskAppearance(this)); @@ -530,10 +530,10 @@ void TaskView::removeDialog(void) if (ActiveCtrl) { taskPanel->removeWidget(ActiveCtrl); delete ActiveCtrl; - ActiveCtrl = 0; + ActiveCtrl = nullptr; } - TaskDialog* remove = NULL; + TaskDialog* remove = nullptr; if (ActiveDialog) { // See 'accept' and 'reject' if (ActiveDialog->property("taskview_accept_or_reject").isNull()) { @@ -542,7 +542,7 @@ void TaskView::removeDialog(void) taskPanel->removeWidget(*it); } remove = ActiveDialog; - ActiveDialog = 0; + ActiveDialog = nullptr; } else { ActiveDialog->setProperty("taskview_remove_dialog", true); diff --git a/src/Gui/TaskView/TaskView.h b/src/Gui/TaskView/TaskView.h index e894c1b2dc..5f1c0b9064 100644 --- a/src/Gui/TaskView/TaskView.h +++ b/src/Gui/TaskView/TaskView.h @@ -61,9 +61,9 @@ class GuiExport TaskGroup : public QSint::ActionBox, public TaskContent Q_OBJECT public: - explicit TaskGroup(QWidget *parent = 0); - explicit TaskGroup(const QString & headerText, QWidget *parent = 0); - explicit TaskGroup(const QPixmap & icon, const QString & headerText, QWidget *parent = 0); + explicit TaskGroup(QWidget *parent = nullptr); + explicit TaskGroup(const QString & headerText, QWidget *parent = nullptr); + explicit TaskGroup(const QPixmap & icon, const QString & headerText, QWidget *parent = nullptr); ~TaskGroup(); protected: @@ -78,7 +78,7 @@ class GuiExport TaskBox : public QSint::ActionGroup, public TaskContent public: /** Constructor. Creates TaskBox without header. */ - explicit TaskBox(QWidget *parent = 0); + explicit TaskBox(QWidget *parent = nullptr); /** Constructor. Creates TaskBox with header's text set to \a title, but with no icon. @@ -87,7 +87,7 @@ public: */ explicit TaskBox(const QString& title, bool expandable = true, - QWidget *parent = 0); + QWidget *parent = nullptr); /** Constructor. Creates TaskBox with header's text set to \a title and icon set to \a icon. @@ -97,7 +97,7 @@ public: explicit TaskBox(const QPixmap& icon, const QString& title, bool expandable = true, - QWidget *parent = 0); + QWidget *parent = nullptr); virtual QSize minimumSizeHint() const; ~TaskBox(); @@ -117,7 +117,7 @@ class GuiExport TaskPanel : public QSint::ActionPanel Q_OBJECT public: - explicit TaskPanel(QWidget *parent = 0); + explicit TaskPanel(QWidget *parent = nullptr); virtual ~TaskPanel(); virtual QSize minimumSizeHint() const; }; @@ -128,7 +128,7 @@ class GuiExport TaskWidget : public QWidget, public TaskContent Q_OBJECT public: - TaskWidget(QWidget *parent=0); + TaskWidget(QWidget *parent=nullptr); ~TaskWidget(); }; @@ -142,7 +142,7 @@ class GuiExport TaskView : public QScrollArea, public Gui::SelectionSingleton::O Q_OBJECT public: - TaskView(QWidget *parent = 0); + TaskView(QWidget *parent = nullptr); ~TaskView(); /// Observer message from the Selection diff --git a/src/Gui/TaskView/TaskWatcher.cpp b/src/Gui/TaskView/TaskWatcher.cpp index 4e00cbdd36..14ae2f6f76 100644 --- a/src/Gui/TaskView/TaskWatcher.cpp +++ b/src/Gui/TaskView/TaskWatcher.cpp @@ -43,7 +43,7 @@ using namespace Gui::TaskView; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TaskWatcher::TaskWatcher(const char* Filter) - : QObject(0),SelectionFilter(Filter) + : QObject(nullptr),SelectionFilter(Filter) { } @@ -83,7 +83,7 @@ TaskWatcherCommands::TaskWatcherCommands(const char* Filter,const char* commands if (commands) { CommandManager &mgr = Gui::Application::Instance->commandManager(); Gui::TaskView::TaskBox *tb = new Gui::TaskView::TaskBox - (BitmapFactory().pixmap(pixmap), tr(name), true, 0); + (BitmapFactory().pixmap(pixmap), tr(name), true, nullptr); for (const char** i=commands;*i;i++) { Command *c = mgr.getCommandByName(*i); @@ -116,7 +116,7 @@ bool TaskWatcherCommands::shouldShow() TaskWatcherCommandsEmptyDoc::TaskWatcherCommandsEmptyDoc(const char* commands[], const char* name, const char* pixmap ) - : TaskWatcherCommands(0,commands,name,pixmap) + : TaskWatcherCommands(nullptr,commands,name,pixmap) { } @@ -141,7 +141,7 @@ bool TaskWatcherCommandsEmptyDoc::shouldShow() TaskWatcherCommandsEmptySelection::TaskWatcherCommandsEmptySelection(const char* commands[], const char* name, const char* pixmap ) - : TaskWatcherCommands(0,commands,name,pixmap) + : TaskWatcherCommands(nullptr,commands,name,pixmap) { } diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index 4b577f61f8..77c3826240 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -40,7 +40,7 @@ using namespace Gui; * Constructs a TextEdit which is a child of 'parent'. */ TextEdit::TextEdit(QWidget* parent) - : QPlainTextEdit(parent), cursorPosition(0), listBox(0) + : QPlainTextEdit(parent), cursorPosition(0), listBox(nullptr) { //Note: Set the correct context to this shortcut as we may use several instances of this //class at a time @@ -219,7 +219,7 @@ struct TextEditorP * syntax highlighting for the Python language. */ TextEditor::TextEditor(QWidget* parent) - : TextEdit(parent), WindowParameter("Editor"), highlighter(0) + : TextEdit(parent), WindowParameter("Editor"), highlighter(nullptr) { d = new TextEditorP(); lineNumberArea = new LineMarker(this); diff --git a/src/Gui/TextEdit.h b/src/Gui/TextEdit.h index 7793ea0102..26a1025ec2 100644 --- a/src/Gui/TextEdit.h +++ b/src/Gui/TextEdit.h @@ -57,7 +57,7 @@ class GuiExport TextEdit : public QPlainTextEdit Q_OBJECT public: - TextEdit(QWidget *parent = 0); + TextEdit(QWidget *parent = nullptr); virtual ~TextEdit(); private Q_SLOTS: @@ -86,7 +86,7 @@ class GuiExport TextEditor : public TextEdit, public WindowParameter Q_OBJECT public: - TextEditor(QWidget *parent = 0); + TextEditor(QWidget *parent = nullptr); ~TextEditor(); void setSyntaxHighlighter(SyntaxHighlighter*); diff --git a/src/Gui/TextureMapping.cpp b/src/Gui/TextureMapping.cpp index 7e1a3f4fca..585fd5aeb6 100644 --- a/src/Gui/TextureMapping.cpp +++ b/src/Gui/TextureMapping.cpp @@ -47,7 +47,7 @@ using namespace Gui::Dialog; /* TRANSLATOR Gui::Dialog::TextureMapping */ TextureMapping::TextureMapping(QWidget* parent, Qt::WindowFlags fl) - : QDialog(parent, fl), grp(0), tex(0), env(0) + : QDialog(parent, fl), grp(nullptr), tex(nullptr), env(nullptr) { ui = new Ui_TextureMapping(); ui->setupUi(this); @@ -178,7 +178,7 @@ void TextureMapping::on_checkEnv_toggled(bool b) TaskTextureMapping::TaskTextureMapping() { dialog = new TextureMapping(); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), dialog->windowTitle(), true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), dialog->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(dialog); Content.push_back(taskbox); } diff --git a/src/Gui/TextureMapping.h b/src/Gui/TextureMapping.h index 787215465b..482dd44625 100644 --- a/src/Gui/TextureMapping.h +++ b/src/Gui/TextureMapping.h @@ -39,7 +39,7 @@ class GuiExport TextureMapping : public QDialog Q_OBJECT public: - TextureMapping(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + TextureMapping(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~TextureMapping(); void accept(); void reject(); diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index d1bfbaa53c..49e8ad87ca 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -42,7 +42,7 @@ using namespace Gui; -Thumbnail::Thumbnail(int s) : viewer(0), size(s) +Thumbnail::Thumbnail(int s) : viewer(nullptr), size(s) { } diff --git a/src/Gui/ToolBarManager.cpp b/src/Gui/ToolBarManager.cpp index 3cde38918e..ef9e90872c 100644 --- a/src/Gui/ToolBarManager.cpp +++ b/src/Gui/ToolBarManager.cpp @@ -78,7 +78,7 @@ ToolBarItem* ToolBarItem::findItem(const std::string& name) } } - return 0; + return nullptr; } ToolBarItem* ToolBarItem::copy() const @@ -150,7 +150,7 @@ QList ToolBarItem::getItems() const // ----------------------------------------------------------- -ToolBarManager* ToolBarManager::_instance=0; +ToolBarManager* ToolBarManager::_instance=nullptr; ToolBarManager* ToolBarManager::getInstance() { @@ -162,7 +162,7 @@ ToolBarManager* ToolBarManager::getInstance() void ToolBarManager::destruct() { delete _instance; - _instance = 0; + _instance = nullptr; } ToolBarManager::ToolBarManager() @@ -360,7 +360,7 @@ QToolBar* ToolBarManager::findToolBar(const QList& toolbars, const QS return *it; } - return 0; // no item with the user data found + return nullptr; // no item with the user data found } QAction* ToolBarManager::findAction(const QList& acts, const QString& item) const @@ -370,7 +370,7 @@ QAction* ToolBarManager::findAction(const QList& acts, const QString& return *it; } - return 0; // no item with the user data found + return nullptr; // no item with the user data found } QList ToolBarManager::toolBars() const diff --git a/src/Gui/ToolBox.h b/src/Gui/ToolBox.h index c0245581f6..9ea0bb97d9 100644 --- a/src/Gui/ToolBox.h +++ b/src/Gui/ToolBox.h @@ -56,7 +56,7 @@ class GuiExport ToolBox : public QWidget Q_OBJECT public: - ToolBox( QWidget *parent=0 ); + ToolBox( QWidget *parent=nullptr ); virtual ~ToolBox(); int addItem ( QWidget * w, const QString & label ); diff --git a/src/Gui/ToolBoxManager.cpp b/src/Gui/ToolBoxManager.cpp index 6202a045fa..b14dcd3105 100644 --- a/src/Gui/ToolBoxManager.cpp +++ b/src/Gui/ToolBoxManager.cpp @@ -38,7 +38,7 @@ using namespace Gui; using DockWnd::ToolBox; -ToolBoxManager* ToolBoxManager::_instance=0; +ToolBoxManager* ToolBoxManager::_instance=nullptr; ToolBoxManager* ToolBoxManager::getInstance() { @@ -50,10 +50,10 @@ ToolBoxManager* ToolBoxManager::getInstance() void ToolBoxManager::destruct() { delete _instance; - _instance = 0; + _instance = nullptr; } -ToolBoxManager::ToolBoxManager() : _toolBox(0L) +ToolBoxManager::ToolBoxManager() : _toolBox(nullptr) { } diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp index c8e629bfc5..9654d3fe8f 100644 --- a/src/Gui/Transform.cpp +++ b/src/Gui/Transform.cpp @@ -282,7 +282,7 @@ void DefaultTransformStrategy::onSelectionChanged(const Gui::SelectionChanges& m /* TRANSLATOR Gui::Dialog::Transform */ Transform::Transform(QWidget* parent, Qt::WindowFlags fl) - : Gui::LocationDialog(parent, fl), strategy(0) + : Gui::LocationDialog(parent, fl), strategy(nullptr) { ui = new Ui_TransformComp(this); ui->resetButton->hide(); @@ -431,7 +431,7 @@ TaskTransform::TaskTransform() this->setButtonPosition(TaskTransform::South); dialog = new Transform(); dialog->showStandardButtons(false); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), dialog->windowTitle(), true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), dialog->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(dialog); Content.push_back(taskbox); } diff --git a/src/Gui/Transform.h b/src/Gui/Transform.h index 9e61bed243..7c1a49f977 100644 --- a/src/Gui/Transform.h +++ b/src/Gui/Transform.h @@ -73,7 +73,7 @@ class GuiExport Transform : public Gui::LocationDialog Q_OBJECT public: - Transform(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + Transform(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~Transform(); void accept(); void reject(); diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 8dc2cb0572..4f682b8bb9 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -260,7 +260,7 @@ public: Connection connectStat; DocumentObjectData(DocumentItem* docItem, ViewProviderDocumentObject* vpd) - : docItem(docItem), viewObject(vpd), rootItem(0) + : docItem(docItem), viewObject(vpd), rootItem(nullptr) { // Setup connections connectIcon = viewObject->signalChangeIcon.connect( @@ -408,7 +408,7 @@ QWidget* TreeWidgetEditDelegate::createEditor( { auto ti = static_cast(index.internalPointer()); if (ti->type() != TreeWidget::ObjectType || index.column() > 1) - return 0; + return nullptr; DocumentObjectItem* item = static_cast(ti); App::DocumentObject* obj = item->object()->getObject(); auto& prop = index.column() ? obj->Label2 : obj->Label; @@ -429,9 +429,9 @@ QWidget* TreeWidgetEditDelegate::createEditor( // --------------------------------------------------------------------------- TreeWidget::TreeWidget(const char* name, QWidget* parent) - : QTreeWidget(parent), SelectionObserver(true, 0), contextItem(0) - , searchObject(0), searchDoc(0), searchContextDoc(0) - , editingItem(0), currentDocItem(0) + : QTreeWidget(parent), SelectionObserver(true, 0), contextItem(nullptr) + , searchObject(nullptr), searchDoc(nullptr), searchContextDoc(nullptr) + , editingItem(nullptr), currentDocItem(nullptr) , myName(name) { Instances.insert(this); @@ -579,7 +579,7 @@ TreeWidget::~TreeWidget() connectChangedViewObj.disconnect(); Instances.erase(this); if (_LastSelectedTreeWidget == this) - _LastSelectedTreeWidget = 0; + _LastSelectedTreeWidget = nullptr; } const char* TreeWidget::getTreeName() const { @@ -649,13 +649,13 @@ void TreeWidget::resetItemSearch() { static_cast(item)->restoreBackground(); } } - searchObject = 0; + searchObject = nullptr; } void TreeWidget::startItemSearch(QLineEdit* edit) { resetItemSearch(); - searchDoc = 0; - searchContextDoc = 0; + searchDoc = nullptr; + searchContextDoc = nullptr; auto sels = selectedItems(); if (sels.size() == 1) { if (sels.front()->type() == DocumentType) { @@ -670,7 +670,7 @@ void TreeWidget::startItemSearch(QLineEdit* edit) { else searchDoc = Application::Instance->activeDocument(); - App::DocumentObject* obj = 0; + App::DocumentObject* obj = nullptr; if (searchContextDoc && searchContextDoc->getDocument()->getObjects().size()) obj = searchContextDoc->getDocument()->getObjects().front(); else if (searchDoc && searchDoc->getDocument()->getObjects().size()) @@ -728,7 +728,7 @@ void TreeWidget::itemSearch(const QString& text, bool select) { return; } std::string subname = path.getSubObjectName(); - App::DocumentObject* parent = 0; + App::DocumentObject* parent = nullptr; if (searchContextDoc) { auto it = DocumentMap.find(searchContextDoc); if (it != DocumentMap.end()) { @@ -791,7 +791,7 @@ Gui::Document* TreeWidget::selectedDocument() { if (sels.size() == 1 && sels[0]->type() == DocumentType) return static_cast(sels[0])->document(); } - return 0; + return nullptr; } void TreeWidget::updateStatus(bool delay) { @@ -927,7 +927,7 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) App::Document* activeDoc = App::GetApplication().getActiveDocument(); subMenu.setTitle(tr("Activate document")); contextMenu.addMenu(&subMenu); - QAction* active = 0; + QAction* active = nullptr; for (std::vector::iterator it = docs.begin(); it != docs.end(); ++it) { QString label = QString::fromUtf8((*it)->Label.getValue()); QAction* action = subMenuGroup.addAction(label); @@ -955,7 +955,7 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) catch (...) { FC_ERR("Unknown exception"); } - contextItem = 0; + contextItem = nullptr; } } @@ -1048,7 +1048,7 @@ void TreeWidget::onStartEditing() #else editingItem = objitem; if (!doc->setEdit(objitem->object(), edit)) - editingItem = 0; + editingItem = nullptr; #endif } } @@ -1198,7 +1198,7 @@ DocumentItem* TreeWidget::getDocumentItem(const Gui::Document* doc) const { auto it = DocumentMap.find(doc); if (it != DocumentMap.end()) return it->second; - return 0; + return nullptr; } void TreeWidget::selectAllInstances(const ViewProviderDocumentObject& vpd) { @@ -1258,7 +1258,7 @@ std::vector TreeWidget::getSelection(App::Document* doc) FC_LOG("skip objects not from current document"); continue; } - ViewProviderDocumentObject* parentVp = 0; + ViewProviderDocumentObject* parentVp = nullptr; auto parent = item->getParentItem(); if (parent) { parentVp = parent->object(); @@ -1269,7 +1269,7 @@ std::vector TreeWidget::getSelection(App::Document* doc) } ret.emplace_back(); auto& sel = ret.back(); - sel.topParent = 0; + sel.topParent = nullptr; std::ostringstream ss; item->getSubName(ss, sel.topParent); if (!sel.topParent) @@ -1325,7 +1325,7 @@ void TreeWidget::onActivateDocument(QAction* active) QByteArray docname = active->data().toByteArray(); Gui::Document* doc = Application::Instance->getDocument((const char*)docname); if (doc && !doc->setActiveView()) - doc->setActiveView(0, View3DInventor::getClassTypeId()); + doc->setActiveView(nullptr, View3DInventor::getClassTypeId()); } Qt::DropActions TreeWidget::supportedDropActions() const @@ -1451,7 +1451,7 @@ void TreeWidget::mouseDoubleClickEvent(QMouseEvent* event) return; } if (!doc->setActiveView()) - doc->setActiveView(0, View3DInventor::getClassTypeId()); + doc->setActiveView(nullptr, View3DInventor::getClassTypeId()); } else if (item->type() == TreeWidget::ObjectType) { DocumentObjectItem* objitem = static_cast(item); @@ -1571,11 +1571,11 @@ void TreeWidget::dragMoveEvent(QDragMoveEvent* event) auto modifier = QApplication::queryKeyboardModifiers(); QTreeWidgetItem* targetItem = itemAt(event->pos()); if (!targetItem || targetItem->isSelected()) { - leaveEvent(0); + leaveEvent(nullptr); event->ignore(); } else if (targetItem->type() == TreeWidget::DocumentType) { - leaveEvent(0); + leaveEvent(nullptr); if (modifier == Qt::ControlModifier) event->setDropAction(Qt::CopyAction); else if (modifier == Qt::AltModifier) @@ -1676,7 +1676,7 @@ void TreeWidget::dragMoveEvent(QDragMoveEvent* event) } } else { - leaveEvent(0); + leaveEvent(nullptr); event->ignore(); } } @@ -1775,7 +1775,7 @@ void TreeWidget::dropEvent(QDropEvent* event) } std::ostringstream targetSubname; - App::DocumentObject* targetParent = 0; + App::DocumentObject* targetParent = nullptr; targetItemObj->getSubName(targetSubname, targetParent); Selection().selStackPush(); Selection().clearCompleteSelection(); @@ -1807,7 +1807,7 @@ void TreeWidget::dropEvent(QDropEvent* event) App::DocumentObject* obj = vpc->getObject(); std::ostringstream str; - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; auto owner = item->getRelativeParent(str, targetItemObj, &topParent, &info.topSubname); if (syncPlacement && topParent) { info.topDoc = topParent->getDocument()->getName(); @@ -1897,7 +1897,7 @@ void TreeWidget::dropEvent(QDropEvent* event) continue; } - ViewProviderDocumentObject* vpp = 0; + ViewProviderDocumentObject* vpp = nullptr; if (da != Qt::LinkAction && info.parentDoc.size()) { auto parentDoc = App::GetApplication().getDocument(info.parentDoc.c_str()); if (parentDoc) { @@ -1911,7 +1911,7 @@ void TreeWidget::dropEvent(QDropEvent* event) } } - App::DocumentObject* owner = 0; + App::DocumentObject* owner = nullptr; if (info.ownerDoc.size()) { auto ownerDoc = App::GetApplication().getDocument(info.ownerDoc.c_str()); if (ownerDoc) @@ -1923,14 +1923,14 @@ void TreeWidget::dropEvent(QDropEvent* event) } Base::Matrix4D mat; - App::PropertyPlacement* propPlacement = 0; + App::PropertyPlacement* propPlacement = nullptr; if (syncPlacement) { if (info.topObj.size()) { auto doc = App::GetApplication().getDocument(info.topDoc.c_str()); if (doc) { auto topObj = doc->getObject(info.topObj.c_str()); if (topObj) { - auto sobj = topObj->getSubObject(info.topSubname.c_str(), 0, &mat); + auto sobj = topObj->getSubObject(info.topSubname.c_str(), nullptr, &mat); if (sobj == obj) { propPlacement = Base::freecad_dynamic_cast( obj->getPropertyByName("Placement")); @@ -1957,7 +1957,7 @@ void TreeWidget::dropEvent(QDropEvent* event) vpp->dragObject(obj); if (manager->getLines() == lines) manager->addLine(MacroManager::Gui, ss.str().c_str()); - owner = 0; + owner = nullptr; subname.clear(); ss.str(""); @@ -1983,7 +1983,7 @@ void TreeWidget::dropEvent(QDropEvent* event) // TODO: link adjustment and placement adjustment does // not work together at the moment. - propPlacement = 0; + propPlacement = nullptr; } } @@ -1997,13 +1997,13 @@ void TreeWidget::dropEvent(QDropEvent* event) auto parentItem = targetItemObj->getParentItem(); if (parentItem) { ss << Command::getObjectCmd( - parentItem->object()->getObject(), 0, ".replaceObject(", true) + parentItem->object()->getObject(), nullptr, ".replaceObject(", true) << Command::getObjectCmd(targetObj) << "," << Command::getObjectCmd(obj) << ")"; std::ostringstream ss; - dropParent = 0; + dropParent = nullptr; parentItem->getSubName(ss, dropParent); if (dropParent) ss << parentItem->object()->getObject()->getNameInDocument() << '.'; @@ -2051,7 +2051,7 @@ void TreeWidget::dropEvent(QDropEvent* event) } Base::Matrix4D newMat; - auto sobj = dropParent->getSubObject(dropName.c_str(), 0, &newMat); + auto sobj = dropParent->getSubObject(dropName.c_str(), nullptr, &newMat); if (!sobj) { FC_LOG("failed to find dropped object " << dropParent->getFullName() << '.' << dropName); @@ -2127,7 +2127,7 @@ void TreeWidget::dropEvent(QDropEvent* event) // We will not drag item out of parent if either, 1) the CTRL // key is held, or 2) the dragging item is not inside the // dropping document tree. - parentItem = 0; + parentItem = nullptr; } else if (!parentItem->object()->canDragObjects() || !parentItem->object()->canDragObject(obj)) @@ -2147,7 +2147,7 @@ void TreeWidget::dropEvent(QDropEvent* event) } if (syncPlacement) { std::ostringstream ss; - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; item->getSubName(ss, topParent); if (topParent) { info.topDoc = topParent->getDocument()->getName(); @@ -2181,14 +2181,14 @@ void TreeWidget::dropEvent(QDropEvent* event) } Base::Matrix4D mat; - App::PropertyPlacement* propPlacement = 0; + App::PropertyPlacement* propPlacement = nullptr; if (syncPlacement) { if (info.topObj.size()) { auto doc = App::GetApplication().getDocument(info.topDoc.c_str()); if (doc) { auto topObj = doc->getObject(info.topObj.c_str()); if (topObj) { - auto sobj = topObj->getSubObject(info.topSubname.c_str(), 0, &mat); + auto sobj = topObj->getSubObject(info.topSubname.c_str(), nullptr, &mat); if (sobj == obj) { propPlacement = dynamic_cast( obj->getPropertyByName("Placement")); @@ -2260,7 +2260,7 @@ void TreeWidget::dropEvent(QDropEvent* event) ss << "App.getDocument('" << thisDoc->getName() << "')." << (da == Qt::CopyAction ? "copyObject(" : "moveObject(") << Command::getObjectCmd(obj) << ", True)"; - App::DocumentObject* res = 0; + App::DocumentObject* res = nullptr; if (da == Qt::CopyAction) { auto copied = thisDoc->copyObject({ obj }, true); if (copied.size()) @@ -2620,7 +2620,7 @@ void TreeWidget::onUpdateStatus(void) if (Selection().hasSelection() && !selectTimer->isActive() && !this->isSelectionBlocked()) { this->blockSelection(true); - currentDocItem = 0; + currentDocItem = nullptr; for (auto& v : DocumentMap) { v.second->setSelected(false); v.second->selectItems(); @@ -2630,7 +2630,7 @@ void TreeWidget::onUpdateStatus(void) auto activeDocItem = getDocumentItem(Application::Instance->activeDocument()); - QTreeWidgetItem* errItem = 0; + QTreeWidgetItem* errItem = nullptr; for (auto obj : errors) { DocumentObjectDataPtr data; if (activeDocItem) { @@ -2711,11 +2711,11 @@ void TreeWidget::onPreSelectTimer() { auto vp = objItem->object(); auto obj = vp->getObject(); std::ostringstream ss; - App::DocumentObject* parent = 0; + App::DocumentObject* parent = nullptr; objItem->getSubName(ss, parent); if (!parent) parent = obj; - else if (!obj->redirectSubName(ss, parent, 0)) + else if (!obj->redirectSubName(ss, parent, nullptr)) ss << obj->getNameInDocument() << '.'; Selection().setPreselect(parent->getDocument()->getName(), parent->getNameInDocument(), ss.str().c_str(), 0, 0, 0, 2); @@ -2766,7 +2766,7 @@ void TreeWidget::scrollItemToTop() if (Gui::Selection().hasSelection(doc->getName())) { tree->currentDocItem = docItem; docItem->selectItems(DocumentItem::SR_FORCE_EXPAND); - tree->currentDocItem = 0; + tree->currentDocItem = nullptr; break; } } @@ -2936,7 +2936,7 @@ void TreeWidget::onItemSelectionChanged() // Gui.Selection and Tree view selection because of newly added // DocumentObject::redirectSubName() Selection().clearCompleteSelection(); - DocumentObjectItem* item = 0; + DocumentObjectItem* item = nullptr; if (selItems.size()) { if (selItems.front()->type() == ObjectType) item = static_cast(selItems.front()); @@ -2955,7 +2955,7 @@ void TreeWidget::onItemSelectionChanged() for (auto& v : DocumentMap) { currentDocItem = v.second; v.second->clearSelection(item); - currentDocItem = 0; + currentDocItem = nullptr; } if (TreeParams::Instance()->RecordSelection()) Gui::Selection().selStackPush(); @@ -2964,7 +2964,7 @@ void TreeWidget::onItemSelectionChanged() for (auto pos = DocumentMap.begin(); pos != DocumentMap.end(); ++pos) { currentDocItem = pos->second; pos->second->updateSelection(pos->second); - currentDocItem = 0; + currentDocItem = nullptr; } if (TreeParams::Instance()->RecordSelection()) Gui::Selection().selStackPush(true, true); @@ -3024,7 +3024,7 @@ void TreeWidget::onSelectTimer() { v.second->setSelected(false); currentDocItem = v.second; v.second->selectItems(syncSelect ? DocumentItem::SR_EXPAND : DocumentItem::SR_SELECT); - currentDocItem = 0; + currentDocItem = nullptr; } } else { @@ -3132,7 +3132,7 @@ void TreePanel::showEditor() void TreePanel::hideEditor() { - static_cast(this->searchBox)->setDocumentObject(0); + static_cast(this->searchBox)->setDocumentObject(nullptr); this->searchBox->clear(); this->searchBox->hide(); this->treeWidget->resetItemSearch(); @@ -3287,7 +3287,7 @@ void DocumentItem::slotInEdit(const Gui::ViewProviderDocumentObject& v) auto doc = Application::Instance->editDocument(); if (!doc) return; - ViewProviderDocumentObject* parentVp = 0; + ViewProviderDocumentObject* parentVp = nullptr; std::string subname; auto vp = doc->getInEdit(&parentVp, &subname); if (!parentVp) @@ -3318,7 +3318,7 @@ void DocumentItem::slotResetEdit(const Gui::ViewProviderDocumentObject& v) else if (item->object() == &v) item->setData(0, Qt::BackgroundRole, QVariant()); END_FOREACH_ITEM - tree->editingItem = 0; + tree->editingItem = nullptr; } void DocumentItem::slotNewObject(const Gui::ViewProviderDocumentObject& obj) { @@ -3351,7 +3351,7 @@ bool DocumentItem::createNewItem(const Gui::ViewProviderDocumentObject& obj, pdata->updateChildren(true); entry.insert(pdata); } - else if (pdata->rootItem && parent == NULL) { + else if (pdata->rootItem && parent == nullptr) { Base::Console().Warning("DocumentItem::slotNewObject: Cannot add view provider twice.\n"); return false; } @@ -3395,7 +3395,7 @@ void TreeWidget::slotDeleteDocument(const Gui::Document& Doc) auto docItem = it->second; for (auto& v : docItem->ObjectMap) { for (auto item : v.second->items) - item->myOwner = 0; + item->myOwner = nullptr; auto obj = v.second->viewObject->getObject(); if (obj->getDocument() == Doc.getDocument()) { _slotDeleteObject(*v.second->viewObject, docItem); @@ -3413,7 +3413,7 @@ void TreeWidget::slotDeleteDocument(const Gui::Document& Doc) } void TreeWidget::slotDeleteObject(const Gui::ViewProviderDocumentObject& view) { - _slotDeleteObject(view, 0); + _slotDeleteObject(view, nullptr); } void TreeWidget::_slotDeleteObject(const Gui::ViewProviderDocumentObject& view, DocumentItem* deletingDoc) @@ -3446,7 +3446,7 @@ void TreeWidget::_slotDeleteObject(const Gui::ViewProviderDocumentObject& view, bool lock = blockSelection(true); for (auto cit = items.begin(), citNext = cit; cit != items.end(); cit = citNext) { ++citNext; - (*cit)->myOwner = 0; + (*cit)->myOwner = nullptr; delete* cit; } blockSelection(lock); @@ -3624,7 +3624,7 @@ void DocumentItem::populateItem(DocumentObjectItem* item, bool refresh, bool del --i; continue; } - it->second->rootItem = 0; + it->second->rootItem = nullptr; childItem->setHighlight(false); this->removeChild(childItem); item->insertChild(i, childItem); @@ -3858,7 +3858,7 @@ void DocumentItem::slotHighlightObject(const Gui::ViewProviderDocumentObject& ob } FOREACH_ITEM(item, obj) if (parent) { - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; std::ostringstream ss; item->getSubName(ss, topParent); if (!topParent) { @@ -4004,7 +4004,7 @@ void DocumentItem::slotExpandObject(const Gui::ViewProviderDocumentObject& obj, item->setExpanded(true); } else { - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; std::ostringstream ss; item->getSubName(ss, topParent); if (!topParent) { @@ -4171,15 +4171,15 @@ void DocumentItem::updateItemSelection(DocumentObjectItem* item) { return; std::ostringstream str; - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; item->getSubName(str, topParent); if (topParent) { if (topParent->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) { // remove legacy selection, i.e. those without subname Gui::Selection().rmvSelection(obj->getDocument()->getName(), - obj->getNameInDocument(), 0); + obj->getNameInDocument(), nullptr); } - if (!obj->redirectSubName(str, topParent, 0)) + if (!obj->redirectSubName(str, topParent, nullptr)) str << obj->getNameInDocument() << '.'; obj = topParent; } @@ -4244,7 +4244,7 @@ void DocumentItem::updateItemSelection(DocumentObjectItem* item) { App::DocumentObject* DocumentItem::getTopParent(App::DocumentObject* obj, std::string& subname) { auto it = ObjectMap.find(obj); if (it == ObjectMap.end() || it->second->items.empty()) - return 0; + return nullptr; // already a top parent if (it->second->rootItem) @@ -4270,7 +4270,7 @@ App::DocumentObject* DocumentItem::getTopParent(App::DocumentObject* obj, std::s items.emplace(i, item); } - App::DocumentObject* topParent = 0; + App::DocumentObject* topParent = nullptr; std::ostringstream ss; items.begin()->second->getSubName(ss, topParent); if (!topParent) { @@ -4293,7 +4293,7 @@ DocumentObjectItem* DocumentItem::findItemByObject( auto it = ObjectMap.find(obj); if (it == ObjectMap.end() || it->second->items.empty()) - return 0; + return nullptr; // prefer top level item of this object if (it->second->rootItem) @@ -4320,7 +4320,7 @@ DocumentObjectItem* DocumentItem::findItemByObject( if (item) return item; } - return 0; + return nullptr; } DocumentObjectItem* DocumentItem::findItem( @@ -4340,8 +4340,8 @@ DocumentObjectItem* DocumentItem::findItem( TREE_TRACE("find next " << subname); // try to find the next level object name - const char* nextsub = 0; - const char* dot = 0; + const char* nextsub = nullptr; + const char* dot = nullptr; if ((dot = strchr(subname, '.'))) nextsub = dot + 1; else { @@ -4388,7 +4388,7 @@ DocumentObjectItem* DocumentItem::findItem( // The sub object is not found. This could happen for geo group, since its // children may be in more than one hierarchy down. bool found = false; - DocumentObjectItem* res = 0; + DocumentObjectItem* res = nullptr; auto it = ObjectMap.find(subObj); if (it != ObjectMap.end()) { for (auto child : it->second->items) { @@ -4420,8 +4420,8 @@ void DocumentItem::selectItems(SelectionReason reason) { for (const auto& sel : sels) findItemByObject(sync, sel.pObject, sel.SubName, true); - DocumentObjectItem* newSelect = 0; - DocumentObjectItem* oldSelect = 0; + DocumentObjectItem* newSelect = nullptr; + DocumentObjectItem* oldSelect = nullptr; FOREACH_ITEM_ALL(item) if (item->selected == 1) { @@ -4510,7 +4510,7 @@ void DocumentItem::selectAllInstances(const ViewProviderDocumentObject& vpd) { // need to populate the oldest parent first populateParents(&vpd, parentMap); - DocumentObjectItem* first = 0; + DocumentObjectItem* first = nullptr; FOREACH_ITEM(item, vpd); if (showItem(item, true) && !first) first = item; @@ -4600,7 +4600,7 @@ DocumentObjectItem::~DocumentObjectItem() myData->items.erase(it); if (myData->rootItem == this) - myData->rootItem = 0; + myData->rootItem = nullptr; if (myOwner && myData->items.empty()) { auto it = myOwner->_ParentMap.find(object()->getObject()); @@ -5043,7 +5043,7 @@ int DocumentObjectItem::isParentGroup() const { DocumentObjectItem* DocumentObjectItem::getParentItem() const { if (parent()->type() != TreeWidget::ObjectType) - return 0; + return nullptr; return static_cast(parent()); } @@ -5071,7 +5071,7 @@ int DocumentObjectItem::getSubName(std::ostringstream& str, App::DocumentObject* // This function traverse from top down, so, when seeing a // non-group object 'PartExtrude', its following children should // not be grouped, so must reset any previous parents here. - topParent = 0; + topParent = nullptr; str.str(""); //reset the current subname return NotGroup; } @@ -5082,7 +5082,7 @@ int DocumentObjectItem::getSubName(std::ostringstream& str, App::DocumentObject* auto obj = parent->object()->getObject(); if (!obj || !obj->getNameInDocument()) { - topParent = 0; + topParent = nullptr; str.str(""); return NotGroup; } @@ -5110,12 +5110,12 @@ App::DocumentObject* DocumentObjectItem::getRelativeParent( App::DocumentObject** topParent, std::string* topSubname) const { std::ostringstream str2; - App::DocumentObject* top = 0, * top2 = 0; + App::DocumentObject* top = nullptr, * top2 = nullptr; getSubName(str, top); if (topParent) *topParent = top; if (!top) - return 0; + return nullptr; if (topSubname) *topSubname = str.str() + getName() + '.'; cousin->getSubName(str2, top2); @@ -5132,7 +5132,7 @@ App::DocumentObject* DocumentObjectItem::getRelativeParent( const char* dot = strchr(sub, '.'); if (!dot) { str.str(""); - return 0; + return nullptr; } const char* dot2 = strchr(sub2, '.'); if (!dot2 || dot - sub != dot2 - sub2 || strncmp(sub, sub2, dot - sub) != 0) { @@ -5141,7 +5141,7 @@ App::DocumentObject* DocumentObjectItem::getRelativeParent( if (!top) { FC_ERR("invalid subname " << top->getFullName() << '.' << substr); str.str(""); - return 0; + return nullptr; } str.str(""); str << dot + 1 << getName() << '.'; @@ -5151,7 +5151,7 @@ App::DocumentObject* DocumentObjectItem::getRelativeParent( sub2 = dot2 + 1; } str.str(""); - return 0; + return nullptr; } void DocumentObjectItem::setCheckState(bool checked) { diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index 5dae3a93e8..a6e62cf26d 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -56,7 +56,7 @@ class TreeWidget : public QTreeWidget, public SelectionObserver Q_OBJECT public: - TreeWidget(const char *name, QWidget* parent=0); + TreeWidget(const char *name, QWidget* parent=nullptr); ~TreeWidget(); static void scrollItemToTop(); @@ -78,7 +78,7 @@ public: * This function can return the non-group parent of the selected object, * which Gui::Selection() cannot provide. */ - static std::vector getSelection(App::Document *doc=0); + static std::vector getSelection(App::Document *doc=nullptr); static TreeWidget *instance(); @@ -262,7 +262,7 @@ public: ~DocumentItem(); Gui::Document* document() const; - void clearSelection(DocumentObjectItem *exclude=0); + void clearSelection(DocumentObjectItem *exclude=nullptr); void updateSelection(QTreeWidgetItem *, bool unselect=false); void updateSelection(); void updateItemSelection(DocumentObjectItem *); @@ -320,7 +320,7 @@ protected: bool updateObject(const Gui::ViewProviderDocumentObject&, const App::Property &prop); bool createNewItem(const Gui::ViewProviderDocumentObject&, - QTreeWidgetItem *parent=0, int index=-1, + QTreeWidgetItem *parent=nullptr, int index=-1, DocumentObjectDataPtr ptrs = DocumentObjectDataPtr()); int findRootIndex(App::DocumentObject *childObj); @@ -395,15 +395,15 @@ public: // return the owner, and full qualified subname App::DocumentObject *getFullSubName(std::ostringstream &str, - DocumentObjectItem *parent = 0) const; + DocumentObjectItem *parent = nullptr) const; // return the immediate descendent of the common ancestor of this item and // 'cousin'. App::DocumentObject *getRelativeParent( std::ostringstream &str, DocumentObjectItem *cousin, - App::DocumentObject **topParent=0, - std::string *topSubname=0) const; + App::DocumentObject **topParent=nullptr, + std::string *topSubname=nullptr) const; // return the top most linked group owner's name, and subname. This method // is necessary despite have getFullSubName above is because native geo group @@ -471,7 +471,7 @@ class TreeDockWidget : public Gui::DockWindow Q_OBJECT public: - TreeDockWidget(Gui::Document* pcDocument,QWidget *parent=0); + TreeDockWidget(Gui::Document* pcDocument,QWidget *parent=nullptr); ~TreeDockWidget(); }; @@ -482,7 +482,7 @@ public: class TreeWidgetEditDelegate: public QStyledItemDelegate { Q_OBJECT public: - TreeWidgetEditDelegate(QObject* parent=0); + TreeWidgetEditDelegate(QObject* parent=nullptr); virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const; }; diff --git a/src/Gui/TreeView.cpp b/src/Gui/TreeView.cpp index 8a17fe6186..3f937ddb5c 100644 --- a/src/Gui/TreeView.cpp +++ b/src/Gui/TreeView.cpp @@ -59,7 +59,7 @@ void TreeView::mouseDoubleClickEvent (QMouseEvent * event) QModelIndex index = indexAt(event->pos()); if (!index.isValid() || index.internalPointer() == Application::Instance) return; - Base::BaseClass* item = 0; + Base::BaseClass* item = nullptr; item = static_cast(index.internalPointer()); if (item->getTypeId() == Document::getClassTypeId()) { QTreeView::mouseDoubleClickEvent(event); diff --git a/src/Gui/TreeView.h b/src/Gui/TreeView.h index 4150372e71..df977409ef 100644 --- a/src/Gui/TreeView.h +++ b/src/Gui/TreeView.h @@ -33,7 +33,7 @@ class GuiExport TreeView : public QTreeView Q_OBJECT public: - TreeView(QWidget* parent=0); + TreeView(QWidget* parent=nullptr); virtual ~TreeView(); protected: diff --git a/src/Gui/VectorListEditor.h b/src/Gui/VectorListEditor.h index db986c3948..82705e1878 100644 --- a/src/Gui/VectorListEditor.h +++ b/src/Gui/VectorListEditor.h @@ -63,7 +63,7 @@ class VectorTableDelegate : public QItemDelegate Q_OBJECT public: - VectorTableDelegate(int decimals, QObject *parent = 0); + VectorTableDelegate(int decimals, QObject *parent = nullptr); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; diff --git a/src/Gui/View.cpp b/src/Gui/View.cpp index 11292ffd87..b7856323b7 100644 --- a/src/Gui/View.cpp +++ b/src/Gui/View.cpp @@ -69,7 +69,7 @@ void BaseView::onClose(void) _pcDocument->detachView(this); } - _pcDocument = 0; + _pcDocument = nullptr; bIsDetached = true; } @@ -95,5 +95,5 @@ void BaseView::setDocument(Gui::Document* pcDocument) /// returns the document the view is attached to App::Document* BaseView::getAppDocument() const { - return _pcDocument ? _pcDocument->getDocument() : 0; + return _pcDocument ? _pcDocument->getDocument() : nullptr; } diff --git a/src/Gui/View.h b/src/Gui/View.h index 67da8ca779..35e7f3095e 100644 --- a/src/Gui/View.h +++ b/src/Gui/View.h @@ -57,7 +57,7 @@ public: * the view will attach to the active document. Be aware! there isn't * always an active document! */ - BaseView(Gui::Document* pcDocument=0); + BaseView(Gui::Document* pcDocument=nullptr); /** View destructor * Detach the view from the document, if attached! */ diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 2d7ff36912..8967c722b0 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -86,7 +86,7 @@ TYPESYSTEM_SOURCE_ABSTRACT(Gui::View3DInventor,Gui::MDIView) View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, const QtGLWidget* sharewidget, Qt::WindowFlags wflags) - : MDIView(pcDocument, parent, wflags), _viewerPy(0) + : MDIView(pcDocument, parent, wflags), _viewerPy(nullptr) { stack = new QStackedWidget(this); // important for highlighting @@ -188,7 +188,7 @@ View3DInventor::~View3DInventor() QWidget* par = foc->parentWidget(); while (par) { if (par == this) { - foc->setFocusProxy(0); + foc->setFocusProxy(nullptr); foc->clearFocus(); break; } @@ -207,8 +207,8 @@ View3DInventor::~View3DInventor() void View3DInventor::deleteSelf() { - _viewer->setSceneGraph(0); - _viewer->setDocument(0); + _viewer->setSceneGraph(nullptr); + _viewer->setDocument(nullptr); MDIView::deleteSelf(); } @@ -963,7 +963,7 @@ void View3DInventor::setCurrentViewMode(ViewMode newmode) qApp->installEventFilter(this); } else if (newmode == Child) { - _viewer->getGLWidget()->setFocusProxy(0); + _viewer->getGLWidget()->setFocusProxy(nullptr); qApp->removeEventFilter(this); QList acts = this->actions(); for (QList::Iterator it = acts.begin(); it != acts.end(); ++it) diff --git a/src/Gui/View3DInventor.h b/src/Gui/View3DInventor.h index 284d60f853..4a7719aade 100644 --- a/src/Gui/View3DInventor.h +++ b/src/Gui/View3DInventor.h @@ -45,7 +45,7 @@ class GuiExport GLOverlayWidget : public QWidget Q_OBJECT public: - GLOverlayWidget(QWidget* parent=0) : QWidget(parent) + GLOverlayWidget(QWidget* parent=nullptr) : QWidget(parent) {} ~GLOverlayWidget() {} @@ -68,7 +68,7 @@ class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverTy TYPESYSTEM_HEADER(); public: - View3DInventor(Gui::Document* pcDocument, QWidget* parent, const QtGLWidget* sharewidget = 0, Qt::WindowFlags wflags=Qt::WindowFlags()); + View3DInventor(Gui::Document* pcDocument, QWidget* parent, const QtGLWidget* sharewidget = nullptr, Qt::WindowFlags wflags=Qt::WindowFlags()); ~View3DInventor(); /// Message handler diff --git a/src/Gui/View3DInventorExamples.cpp b/src/Gui/View3DInventorExamples.cpp index 2c096a7010..e0225ea2af 100644 --- a/src/Gui/View3DInventorExamples.cpp +++ b/src/Gui/View3DInventorExamples.cpp @@ -224,7 +224,7 @@ void Texture3D(SoSeparator * root) SoTransformerDragger * dragger = new SoTransformerDragger; dragger->scaleFactor.setValue(5,5,5); - dragger->addValueChangedCallback(draggerCB, NULL); + dragger->addValueChangedCallback(draggerCB, nullptr); root->addChild(dragger); SoCoordinate3 * clippedCoords = new SoCoordinate3; @@ -276,7 +276,7 @@ void LightManip(SoSeparator * root) SoInput in; in.setBuffer((void *)scenegraph, std::strlen(scenegraph)); SoSeparator * _root = SoDB::readAll( &in ); - if ( _root == NULL ) return; // Shouldn't happen. + if ( _root == nullptr ) return; // Shouldn't happen. root->addChild(_root); root->ref(); @@ -289,7 +289,7 @@ void LightManip(SoSeparator * root) sa.setSearchingAll( false ); sa.apply( root ); SoPath * path = sa.getPath(); - if ( path == NULL) return; // Shouldn't happen. + if ( path == nullptr) return; // Shouldn't happen. SoPointLightManip * manip = new SoPointLightManip; manip->replaceNode( path ); @@ -394,7 +394,7 @@ timersensorcallback(void * data, SoSensor *) void AnimationTexture(SoSeparator * root) { // Scene graph - if ( root == NULL ) return; // Shouldn't happen. + if ( root == nullptr ) return; // Shouldn't happen. // Generate a julia set to use as a texturemap julia(global_cr, global_ci, 2.5, texturewidth, textureheight, 4, bitmap, 64); diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 5799af4ab0..cf44cd10ab 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -250,7 +250,7 @@ public: Spaceball::MotionEvent* motionEvent = static_cast(event); if (!motionEvent) { Base::Console().Log("invalid spaceball motion event\n"); - return NULL; + return nullptr; } motionEvent->setHandled(true); @@ -275,7 +275,7 @@ public: return motion3Event; } - return NULL; + return nullptr; } }; @@ -294,18 +294,18 @@ public: View3DInventorViewer::View3DInventorViewer(QWidget* parent, const QtGLWidget* sharewidget) : Quarter::SoQTQuarterAdaptor(parent, sharewidget), SelectionObserver(false,0), - editViewProvider(0), navigation(0), - renderType(Native), framebuffer(0), axisCross(0), axisGroup(0), editing(false), redirected(false), - allowredir(false), overrideMode("As Is"), _viewerPy(0) + editViewProvider(nullptr), navigation(nullptr), + renderType(Native), framebuffer(nullptr), axisCross(nullptr), axisGroup(nullptr), editing(false), redirected(false), + allowredir(false), overrideMode("As Is"), _viewerPy(nullptr) { init(); } View3DInventorViewer::View3DInventorViewer(const QtGLFormat& format, QWidget* parent, const QtGLWidget* sharewidget) : Quarter::SoQTQuarterAdaptor(format, parent, sharewidget), SelectionObserver(false,0), - editViewProvider(0), navigation(0), - renderType(Native), framebuffer(0), axisCross(0), axisGroup(0), editing(false), redirected(false), - allowredir(false), overrideMode("As Is"), _viewerPy(0) + editViewProvider(nullptr), navigation(nullptr), + renderType(Native), framebuffer(nullptr), axisCross(nullptr), axisGroup(nullptr), editing(false), redirected(false), + allowredir(false), overrideMode("As Is"), _viewerPy(nullptr) { init(); } @@ -315,7 +315,7 @@ void View3DInventorViewer::init() static bool _cacheModeInited; if(!_cacheModeInited) { _cacheModeInited = true; - pcViewProviderRoot = 0; + pcViewProviderRoot = nullptr; setRenderCache(-1); } @@ -459,7 +459,7 @@ void View3DInventorViewer::init() pcGroupOnTopPreSel->ref(); pcGroupOnTop->addChild(pcGroupOnTopPreSel); - pcClipPlane = 0; + pcClipPlane = nullptr; pcEditingRoot = new SoSeparator; pcEditingRoot->ref(); @@ -544,24 +544,24 @@ View3DInventorViewer::~View3DInventorViewer() // cleanup this->backgroundroot->unref(); - this->backgroundroot = 0; + this->backgroundroot = nullptr; this->foregroundroot->unref(); - this->foregroundroot = 0; + this->foregroundroot = nullptr; this->pcBackGround->unref(); - this->pcBackGround = 0; + this->pcBackGround = nullptr; - setSceneGraph(0); + setSceneGraph(nullptr); this->pEventCallback->unref(); - this->pEventCallback = 0; + this->pEventCallback = nullptr; // Note: It can happen that there is still someone who references // the root node but isn't destroyed when closing this viewer so // that it prevents all children from being deleted. To reduce this // likelihood we explicitly remove all child nodes now. coinRemoveAllChildren(this->pcViewProviderRoot); this->pcViewProviderRoot->unref(); - this->pcViewProviderRoot = 0; + this->pcViewProviderRoot = nullptr; this->backlight->unref(); - this->backlight = 0; + this->backlight = nullptr; this->pcGroupOnTop->unref(); this->pcGroupOnTopPreSel->unref(); @@ -585,7 +585,7 @@ View3DInventorViewer::~View3DInventorViewer() delete viewerEventFilter; if (_viewerPy) { - static_cast(_viewerPy)->_viewer = 0; + static_cast(_viewerPy)->_viewer = nullptr; Py_DECREF(_viewerPy); } @@ -634,7 +634,7 @@ void View3DInventorViewer::aboutToDestroyGLContext() if (gl) gl->makeCurrent(); delete naviCube; - naviCube = 0; + naviCube = nullptr; naviCubeEnabled = false; } } @@ -829,7 +829,7 @@ void View3DInventorViewer::checkGroupOnTop(const SelectionChanges &Reason) { path.append(grpVp->getChildRoot()); } - SoDetail *det = 0; + SoDetail *det = nullptr; if(vp->getDetailPath(subname, &path,true,det) && path.getLength()) { auto node = new SoFCPathAnnotation; node->setPath(&path); @@ -845,7 +845,7 @@ void View3DInventorViewer::checkGroupOnTop(const SelectionChanges &Reason) { action.apply(&tmpPath); tmpPath.unrefNoDelete(); node->setDetail(det); - det = 0; + det = nullptr; } FC_LOG("add annotation " << Reason.Type << " " << key); objs[key.c_str()] = node; @@ -1107,7 +1107,7 @@ SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec2s& pos, ViewProvi path->unref(); SoPickedPoint* pick = rp.getPickedPoint(); - return (pick ? new SoPickedPoint(*pick) : 0); + return (pick ? new SoPickedPoint(*pick) : nullptr); } SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec3f& pos,const SbVec3f& dir, ViewProvider* vp) const @@ -1158,7 +1158,7 @@ SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec3f& pos,const SbVe // returns a copy of the point SoPickedPoint* pick = rp.getPickedPoint(); //return (pick ? pick->copy() : 0); // needs the same instance of CRT under MS Windows - return (pick ? new SoPickedPoint(*pick) : 0); + return (pick ? new SoPickedPoint(*pick) : nullptr); } void View3DInventorViewer::setEditingViewProvider(Gui::ViewProvider* p, int ModNum) @@ -1184,7 +1184,7 @@ void View3DInventorViewer::resetEditingViewProvider() this->editViewProvider->unsetEditViewer(this); removeEventCallback(SoEvent::getClassTypeId(), Gui::ViewProvider::eventCallback,this->editViewProvider); - this->editViewProvider = 0; + this->editViewProvider = nullptr; } } @@ -1415,7 +1415,7 @@ void View3DInventorViewer::setAxisCross(bool on) else { if (axisGroup) { sep->removeChild(axisGroup); - axisGroup = 0; + axisGroup = nullptr; } } } @@ -1481,7 +1481,7 @@ void View3DInventorViewer::setSceneGraph(SoNode* root) if (!root) { _ViewProviderSet.clear(); _ViewProviderMap.clear(); - editViewProvider = 0; + editViewProvider = nullptr; } SoSearchAction sa; @@ -1543,7 +1543,7 @@ void View3DInventorViewer::savePicture(int w, int h, int s, const QColor& bg, QI //If we need to support grayscale images with must either use SoOffscreenRenderer::LUMINANCE or //SoOffscreenRenderer::LUMINANCE_TRANSPARENCY. - SoCallback* cb = 0; + SoCallback* cb = nullptr; // for an invalid color use the viewer's current background color QColor bgColor; @@ -1981,7 +1981,7 @@ void View3DInventorViewer::setRenderType(const RenderType type) glImage = QImage(); if (type != Framebuffer) { delete framebuffer; - framebuffer = 0; + framebuffer = nullptr; } switch (type) { @@ -2673,7 +2673,7 @@ void View3DInventorViewer::toggleClippingPlane(int toggle, bool beforeEditing, if(toggle<=0) { pcViewProviderRoot->removeChild(pcClipPlane); pcClipPlane->unref(); - pcClipPlane = 0; + pcClipPlane = nullptr; } return; }else if(toggle==0) @@ -2747,7 +2747,7 @@ SoPickedPoint* View3DInventorViewer::pickPoint(const SbVec2s& pos) const // returns a copy of the point SoPickedPoint* pick = rp.getPickedPoint(); //return (pick ? pick->copy() : 0); // needs the same instance of CRT under MS Windows - return (pick ? new SoPickedPoint(*pick) : 0); + return (pick ? new SoPickedPoint(*pick) : nullptr); } const SoPickedPoint* View3DInventorViewer::getPickedPoint(SoEventCallback* n) const @@ -2786,7 +2786,7 @@ void View3DInventorViewer::setCameraType(SoType t) // close camera but we don't have this other ugly effect. SoCamera* cam = this->getSoRenderManager()->getCamera(); - if(cam == 0) return; + if(cam == nullptr) return; static_cast(cam)->heightAngle = (float)(M_PI / 4.0); } @@ -2827,7 +2827,7 @@ namespace Gui { void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& pos, int steps, int ms) { SoCamera* cam = this->getSoRenderManager()->getCamera(); - if (cam == 0) return; + if (cam == nullptr) return; CameraAnimation anim(cam, rot, pos); anim.setDuration(Base::clamp(ms,0,5000)); @@ -3044,7 +3044,7 @@ void View3DInventorViewer::viewAll(float factor) void View3DInventorViewer::viewSelection() { Base::BoundBox3d bbox; - for(auto &sel : Selection().getSelection(0,0)) { + for(auto &sel : Selection().getSelection(nullptr,0)) { auto vp = Application::Instance->getViewProvider(sel.pObject); if(!vp) continue; @@ -3595,7 +3595,7 @@ ViewProvider* View3DInventorViewer::getViewProviderByPath(SoPath* path) const } } } - return 0; + return nullptr; } ViewProvider* View3DInventorViewer::getViewProviderByPathFromTail(SoPath* path) const @@ -3612,7 +3612,7 @@ ViewProvider* View3DInventorViewer::getViewProviderByPathFromTail(SoPath* path) } } - return 0; + return nullptr; } std::vector View3DInventorViewer::getViewProvidersOfType(const Base::Type& typeId) const diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index c016552c2c..571dd5755e 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -130,8 +130,8 @@ public: }; //@} - View3DInventorViewer (QWidget *parent, const QtGLWidget* sharewidget = 0); - View3DInventorViewer (const QtGLFormat& format, QWidget *parent, const QtGLWidget* sharewidget = 0); + View3DInventorViewer (QWidget *parent, const QtGLWidget* sharewidget = nullptr); + View3DInventorViewer (const QtGLFormat& format, QWidget *parent, const QtGLWidget* sharewidget = nullptr); virtual ~View3DInventorViewer(); void init(); @@ -204,7 +204,7 @@ public: SbBool isEditingViewProvider() const; /// reset from edit mode void resetEditingViewProvider(); - void setupEditingRoot(SoNode *node=0, const Base::Matrix4D *mat=0); + void setupEditingRoot(SoNode *node=nullptr, const Base::Matrix4D *mat=nullptr); void resetEditingRoot(bool updateLinks=true); void setEditingTransform(const Base::Matrix4D &mat); /** Helper method to get picked entities while editing. @@ -241,9 +241,9 @@ public: void abortSelection(); void stopSelection(); bool isSelecting() const; - std::vector getGLPolygon(SelectionRole* role=0) const; + std::vector getGLPolygon(SelectionRole* role=nullptr) const; std::vector getGLPolygon(const std::vector&) const; - const std::vector& getPolygon(SelectionRole* role=0) const; + const std::vector& getPolygon(SelectionRole* role=nullptr) const; void setSelectionEnabled(const SbBool enable); SbBool isSelectionEnabled(void) const; //@} @@ -278,11 +278,11 @@ public: * Set up a callback function \a cb which will be invoked for the given eventtype. * \a userdata will be given as the first argument to the callback function. */ - void addEventCallback(SoType eventtype, SoEventCallbackCB * cb, void* userdata = 0); + void addEventCallback(SoType eventtype, SoEventCallbackCB * cb, void* userdata = nullptr); /** * Unregister the given callback function \a cb. */ - void removeEventCallback(SoType eventtype, SoEventCallbackCB * cb, void* userdata = 0); + void removeEventCallback(SoType eventtype, SoEventCallbackCB * cb, void* userdata = nullptr); /** @name Clipping plane, near and far plane */ //@{ diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index feb6609bd7..060cd09b69 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -249,7 +249,7 @@ Py::Object View3DInventorPy::repr() return Py::String(s_out.str()); } -View3DInventorPy::method_varargs_handler View3DInventorPy::pycxx_handler = 0; +View3DInventorPy::method_varargs_handler View3DInventorPy::pycxx_handler = nullptr; PyObject *View3DInventorPy::method_varargs_ext_handler(PyObject *_self_and_name_tuple, PyObject *_args) { @@ -362,7 +362,7 @@ Py::Object View3DInventorPy::fitAll(const Py::Tuple& args) Py::Object View3DInventorPy::boxZoom(const Py::Tuple& args, const Py::Dict& kwds) { - static char* kwds_box[] = {"XMin", "YMin", "XMax", "YMax", NULL}; + static char* kwds_box[] = {"XMin", "YMin", "XMax", "YMax", nullptr}; short xmin, ymin, xmax, ymax; if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "hhhh", kwds_box, &xmin, &ymin, &xmax, &ymax)) @@ -925,7 +925,7 @@ Py::Object View3DInventorPy::getCameraOrientation(const Py::Tuple& args) Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args) { - PyObject* p=0; + PyObject* p=nullptr; int steps = 20; int ms = 30; if (!PyArg_ParseTuple(args.ptr(), "|O!ii",&Base::PlacementPy::Type,&p,&steps,&ms)) @@ -1091,7 +1091,7 @@ Py::Object View3DInventorPy::getCameraNode(const Py::Tuple& args) try { SoNode* camera = getView3DIventorPtr()->getViewer()->getSoRenderManager()->getCamera(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; std::string type; type = "So"; // seems that So prefix is missing in camera node type += camera->getTypeId().getName().getString(); @@ -1112,7 +1112,7 @@ Py::Object View3DInventorPy::getCamera(const Py::Tuple& args) SoOutput out; char buffer[512]; - out.setBuffer(buffer, 512, 0); + out.setBuffer(buffer, 512, nullptr); try { SoWriteAction wa(&out); @@ -1211,7 +1211,7 @@ Py::Object View3DInventorPy::setCamera(const Py::Tuple& args) } //FIXME: Once View3DInventor inherits from PropertyContainer we can use PropertyEnumeration. -const char* CameraTypeEnums[]= {"Orthographic","Perspective",NULL}; +const char* CameraTypeEnums[]= {"Orthographic","Perspective",nullptr}; Py::Object View3DInventorPy::getCameraType(const Py::Tuple& args) { @@ -2197,7 +2197,7 @@ Py::Object View3DInventorPy::setAnnotation(const Py::Tuple& args) char *psAnnoName,*psBuffer; if (!PyArg_ParseTuple(args.ptr(), "ss", &psAnnoName, &psBuffer)) throw Py::Exception(); - ViewProviderExtern* view = 0; + ViewProviderExtern* view = nullptr; try { view = new ViewProviderExtern(); view->setModeByString(psAnnoName, psBuffer); @@ -2216,7 +2216,7 @@ Py::Object View3DInventorPy::removeAnnotation(const Py::Tuple& args) char *psAnnoName; if (!PyArg_ParseTuple(args.ptr(), "s", &psAnnoName)) throw Py::Exception(); - ViewProvider* view = 0; + ViewProvider* view = nullptr; view = getView3DIventorPtr()->getGuiDocument()->getAnnotationViewProvider(psAnnoName); if (view) { getView3DIventorPtr()->getGuiDocument()->removeAnnotationViewProvider(psAnnoName); @@ -2237,7 +2237,7 @@ Py::Object View3DInventorPy::getSceneGraph(const Py::Tuple& args) try { SoNode* scene = getView3DIventorPtr()->getViewer()->getSceneGraph(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoSeparator *", (void*)scene, 1); scene->ref(); return Py::Object(proxy, true); @@ -2263,7 +2263,7 @@ void View3DInventorPy::eventCallbackPivy(void * ud, SoEventCallback * n) std::string type = e->getTypeId().getName().getString(); type += " *"; - PyObject* proxy = 0; + PyObject* proxy = nullptr; try { proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)e, 0); // now run the method @@ -2296,7 +2296,7 @@ void View3DInventorPy::eventCallbackPivyEx(void * ud, SoEventCallback * n) Base::PyGILStateLocker lock; std::string type = "SoEventCallback *"; - PyObject* proxy = 0; + PyObject* proxy = nullptr; try { proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)n, 0); // now run the method @@ -2332,7 +2332,7 @@ Py::Object View3DInventorPy::addEventCallbackPivy(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "OO|i", &proxy, &method,&ex)) throw Py::Exception(); - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0); } @@ -2374,7 +2374,7 @@ Py::Object View3DInventorPy::removeEventCallbackPivy(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "OO|i", &proxy, &method,&ex)) throw Py::Exception(); - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0); } @@ -2428,7 +2428,7 @@ Py::Object View3DInventorPy::hasAxisCross(const Py::Tuple& args) void View3DInventorPy::draggerCallback(void * ud, SoDragger* n) { Base::PyGILStateLocker lock; - PyObject* proxy = 0; + PyObject* proxy = nullptr; try { proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoDragger *", (void*)n, 0); //call the method @@ -2466,7 +2466,7 @@ Py::Object View3DInventorPy::addDraggerCallback(const Py::Tuple& args) //Check if dragger is a SoDragger object and cast - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0); } @@ -2518,7 +2518,7 @@ Py::Object View3DInventorPy::removeDraggerCallback(const Py::Tuple& args) throw Py::Exception(); //Check if dragger is a SoDragger object and cast - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0); } @@ -2560,12 +2560,12 @@ Py::Object View3DInventorPy::setActiveObject(const Py::Tuple& args) { PyObject* docObject = Py_None; char* name; - char *subname = 0; + char *subname = nullptr; if (!PyArg_ParseTuple(args.ptr(), "s|Os", &name, &docObject, &subname)) throw Py::Exception(); if (docObject == Py_None) { - getView3DIventorPtr()->setActiveObject(0, name); + getView3DIventorPtr()->setActiveObject(nullptr, name); } else { if (!PyObject_TypeCheck(docObject, &App::DocumentObjectPy::Type)) @@ -2584,7 +2584,7 @@ Py::Object View3DInventorPy::getActiveObject(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "s|O", &name,&resolve)) throw Py::Exception(); - App::DocumentObject *parent = 0; + App::DocumentObject *parent = nullptr; std::string subname; App::DocumentObject* obj = getView3DIventorPtr()->getActiveObject(name,&parent,&subname); if (!obj) @@ -2645,7 +2645,7 @@ Py::Object View3DInventorPy::setName(const Py::Tuple& args) Py::Object View3DInventorPy::toggleClippingPlane(const Py::Tuple& args, const Py::Dict& kwds) { - static char* keywords[] = {"toggle", "beforeEditing", "noManip", "pla", NULL}; + static char* keywords[] = {"toggle", "beforeEditing", "noManip", "pla", nullptr}; int toggle = -1; PyObject *beforeEditing = Py_False; PyObject *noManip = Py_True; diff --git a/src/Gui/View3DViewerPy.cpp b/src/Gui/View3DViewerPy.cpp index 2d608ed101..51d568573e 100644 --- a/src/Gui/View3DViewerPy.cpp +++ b/src/Gui/View3DViewerPy.cpp @@ -120,7 +120,7 @@ Py::Object View3DInventorViewerPy::repr() return Py::String(s_out.str()); } -View3DInventorViewerPy::method_varargs_handler View3DInventorViewerPy::pycxx_handler = 0; +View3DInventorViewerPy::method_varargs_handler View3DInventorViewerPy::pycxx_handler = nullptr; PyObject *View3DInventorViewerPy::method_varargs_ext_handler(PyObject *_self_and_name_tuple, PyObject *_args) { @@ -178,7 +178,7 @@ Py::Object View3DInventorViewerPy::getSoRenderManager(const Py::Tuple& args) try { SoRenderManager* manager = _viewer->getSoRenderManager(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoRenderManager *", (void*)manager, 0); return Py::Object(proxy, true); } @@ -194,7 +194,7 @@ Py::Object View3DInventorViewerPy::getSceneGraph(const Py::Tuple& args) try { SoNode* scene = _viewer->getSceneGraph(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoSeparator *", (void*)scene, 1); scene->ref(); return Py::Object(proxy, true); @@ -210,7 +210,7 @@ Py::Object View3DInventorViewerPy::setSceneGraph(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "O", &proxy)) throw Py::Exception(); - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", proxy, &ptr, 0); SoNode* node = static_cast(ptr); @@ -229,7 +229,7 @@ Py::Object View3DInventorViewerPy::getSoEventManager(const Py::Tuple& args) try { SoEventManager* manager = _viewer->getSoEventManager(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoEventManager *", (void*)manager, 0); return Py::Object(proxy, true); } @@ -381,14 +381,14 @@ Py::Object View3DInventorViewerPy::setupEditingRoot(const Py::Tuple& args) throw Py::Exception(); } - Base::Matrix4D *mat = 0; + Base::Matrix4D *mat = nullptr; if(pymat != Py_None) mat = static_cast(pymat)->getMatrixPtr(); try { - SoNode *node = 0; + SoNode *node = nullptr; if(pynode!=Py_None) { - void* ptr = 0; + void* ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", pynode, &ptr, 0); node = reinterpret_cast(ptr); } diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 662609f5ce..dc265b759d 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -88,8 +88,8 @@ void coinRemoveAllChildren(SoGroup *group) { PROPERTY_SOURCE_ABSTRACT(Gui::ViewProvider, App::TransactionalObject) ViewProvider::ViewProvider() - : pcAnnotation(0) - , pyViewObject(0) + : pcAnnotation(nullptr) + , pyViewObject(nullptr) , overrideMode("As Is") , _iActualMode(-1) , _iEditMode(-1) @@ -140,7 +140,7 @@ ViewProvider *ViewProvider::startEditing(int ModNum) _iEditMode = ModNum; return this; } - return 0; + return nullptr; } int ViewProvider::getEditingMode() const @@ -404,7 +404,7 @@ SoNode* ViewProvider::getDisplayMaskMode(const char* type) const return pcModeSwitch->getChild(it->second); } - return 0; + return nullptr; } std::vector ViewProvider::getDisplayMaskModes() const @@ -433,7 +433,7 @@ void ViewProvider::setDisplayMode(const char* ModeName) const char* ViewProvider::getDefaultDisplayMode() const { - return 0; + return nullptr; } vector ViewProvider::getDisplayModes(void) const { @@ -910,7 +910,7 @@ bool ViewProvider::getElementPicked(const SoPickedPoint *pp, std::string &subnam if(ext->extensionGetElementPicked(pp,subname)) return true; } - subname = getElement(pp?pp->getDetail():0); + subname = getElement(pp?pp->getDetail():nullptr); return true; } @@ -962,7 +962,7 @@ int ViewProvider::partialRender(const std::vector &elements, bool c if(hidden) element.resize(element.size()-hiddenMarker().size()); path->truncate(0); - SoDetail *det = 0; + SoDetail *det = nullptr; if(getDetailPath(element.c_str(),path,false,det)) { if(!hidden && !det) { FC_LOG("partial render element not found: " << element); @@ -1028,7 +1028,7 @@ Base::BoundBox3d ViewProvider::getBoundingBox(const char *subname, bool transfor SoTempPath path(20); path.ref(); if(subname && subname[0]) { - SoDetail *det=0; + SoDetail *det=nullptr; if(!getDetailPath(subname,&path,true,det)) { if(mode < 0) pcModeSwitch->whichChild = mode; diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index 40f5707ae9..ed7682e52e 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -166,7 +166,7 @@ public: /// return a hit element to the selection path or 0 virtual std::string getElement(const SoDetail *) const { return std::string(); } /// return the coin node detail of the subelement - virtual SoDetail* getDetail(const char *) const { return 0; } + virtual SoDetail* getDetail(const char *) const { return nullptr; } /** return the coin node detail and path to the node of the subelement * @@ -209,7 +209,7 @@ public: * This method shall work regardless whether the current view object is * visible or not. */ - Base::BoundBox3d getBoundingBox(const char *subname=0, bool transform=true, MDIView *view=0) const; + Base::BoundBox3d getBoundingBox(const char *subname=nullptr, bool transform=true, MDIView *view=nullptr) const; /** * Get called if the object is about to get deleted. @@ -404,7 +404,7 @@ public: /** @name Color management methods */ //@{ - virtual std::map getElementColors(const char *element=0) const { + virtual std::map getElementColors(const char *element=nullptr) const { (void)element; return {}; } diff --git a/src/Gui/ViewProviderAnnotation.cpp b/src/Gui/ViewProviderAnnotation.cpp index a7a9650f65..2589523ab6 100644 --- a/src/Gui/ViewProviderAnnotation.cpp +++ b/src/Gui/ViewProviderAnnotation.cpp @@ -61,8 +61,8 @@ using namespace Gui; -const char* ViewProviderAnnotation::JustificationEnums[]= {"Left","Right","Center",NULL}; -const char* ViewProviderAnnotation::RotationAxisEnums[]= {"X","Y","Z",NULL}; +const char* ViewProviderAnnotation::JustificationEnums[]= {"Left","Right","Center",nullptr}; +const char* ViewProviderAnnotation::RotationAxisEnums[]= {"X","Y","Z",nullptr}; PROPERTY_SOURCE(Gui::ViewProviderAnnotation, Gui::ViewProviderDocumentObject) @@ -272,7 +272,7 @@ void ViewProviderAnnotation::updateData(const App::Property* prop) // ---------------------------------------------------------------------------- -const char* ViewProviderAnnotationLabel::JustificationEnums[]= {"Left","Right","Center",NULL}; +const char* ViewProviderAnnotationLabel::JustificationEnums[]= {"Left","Right","Center",nullptr}; PROPERTY_SOURCE(Gui::ViewProviderAnnotationLabel, Gui::ViewProviderDocumentObject) diff --git a/src/Gui/ViewProviderBuilder.cpp b/src/Gui/ViewProviderBuilder.cpp index 920be874c5..2abfac4236 100644 --- a/src/Gui/ViewProviderBuilder.cpp +++ b/src/Gui/ViewProviderBuilder.cpp @@ -55,7 +55,7 @@ ViewProvider* ViewProviderBuilder::create(const Base::Type& type) std::map::iterator it = _prop_to_view.find(type); if (it != _prop_to_view.end()) return reinterpret_cast(it->second.createInstance()); - return 0; + return nullptr; } Gui::SoFCSelection* ViewProviderBuilder::createSelection() diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index 5fffb2fb92..26daa82db9 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -69,10 +69,10 @@ ViewProviderDocumentObject::ViewProviderDocumentObject() ADD_PROPERTY_TYPE(ShowInTree, (true), dogroup, App::Prop_None, "Show the object in the tree view"); ADD_PROPERTY_TYPE(SelectionStyle, ((long)0), sgroup, App::Prop_None, "Set the object selection style"); - static const char *SelectionStyleEnum[] = {"Shape","BoundBox",0}; + static const char *SelectionStyleEnum[] = {"Shape","BoundBox",nullptr}; SelectionStyle.setEnums(SelectionStyleEnum); - static const char* OnTopEnum[]= {"Disabled","Enabled","Object","Element",NULL}; + static const char* OnTopEnum[]= {"Disabled","Enabled","Object","Element",nullptr}; ADD_PROPERTY_TYPE(OnTopWhenSelected,((long int)0), sgroup, App::Prop_None, "Enabled: Display the object on top of any other object when selected\n" "Object: On top only if the whole object is selected\n" @@ -86,7 +86,7 @@ ViewProviderDocumentObject::~ViewProviderDocumentObject() { // Make sure that the property class does not destruct our string list DisplayMode.setContainer(nullptr); - DisplayMode.setEnums(0); + DisplayMode.setEnums(nullptr); } void ViewProviderDocumentObject::getTaskViewContent(std::vector& vec) const @@ -156,7 +156,7 @@ void ViewProviderDocumentObject::onBeforeChange(const App::Property* prop) { if (isAttachedToDocument()) { App::DocumentObject* obj = getObject(); - App::Document* doc = obj ? obj->getDocument() : 0; + App::Document* doc = obj ? obj->getDocument() : nullptr; if (doc) { onBeforeChangeProperty(doc, prop); } @@ -346,7 +346,7 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj) for (std::vector::iterator it = aDisplayModesArray.begin(); it != aDisplayModesArray.end(); ++it) { aDisplayEnumsArray.push_back( it->c_str() ); } - aDisplayEnumsArray.push_back(0); // null termination + aDisplayEnumsArray.push_back(nullptr); // null termination DisplayMode.setEnums(&(aDisplayEnumsArray[0])); if(!isRestoring()) { @@ -441,7 +441,7 @@ Gui::MDIView* ViewProviderDocumentObject::getViewOfNode(SoNode* node) const SoNode* ViewProviderDocumentObject::findFrontRootOfType(const SoType& type) const { if(!pcObject) - return 0; + return nullptr; // first get the document this object is part of and get its GUI counterpart App::Document* pAppDoc = pcObject->getDocument(); Gui::Document* pGuiDoc = Gui::Application::Instance->getDocument(pAppDoc); @@ -470,7 +470,7 @@ SoNode* ViewProviderDocumentObject::findFrontRootOfType(const SoType& type) cons } } - return 0; + return nullptr; } void ViewProviderDocumentObject::setActiveMode() @@ -625,7 +625,7 @@ bool ViewProviderDocumentObject::getDetailPath(const char *subname, SoFullPath * if(det) { delete det; - det = 0; + det = nullptr; } const char *dot = strchr(subname,'.'); diff --git a/src/Gui/ViewProviderDocumentObject.h b/src/Gui/ViewProviderDocumentObject.h index aa8dfbe7ce..f18c4fed03 100644 --- a/src/Gui/ViewProviderDocumentObject.h +++ b/src/Gui/ViewProviderDocumentObject.h @@ -124,8 +124,8 @@ public: virtual bool removeDynamicProperty(const char* prop) override; virtual App::Property* addDynamicProperty( - const char* type, const char* name=0, - const char* group=0, const char* doc=0, + const char* type, const char* name=nullptr, + const char* group=nullptr, const char* doc=nullptr, short attr=0, bool ro=false, bool hidden=false) override; /** Return the linked view object @@ -140,7 +140,7 @@ public: * itself. */ virtual ViewProviderDocumentObject *getLinkedViewProvider( - std::string *subname=0, bool recursive=false) const; + std::string *subname=nullptr, bool recursive=false) const; virtual std::string getFullName() const override; diff --git a/src/Gui/ViewProviderDragger.cpp b/src/Gui/ViewProviderDragger.cpp index e34116d287..94bc043c56 100644 --- a/src/Gui/ViewProviderDragger.cpp +++ b/src/Gui/ViewProviderDragger.cpp @@ -91,7 +91,7 @@ void ViewProviderDragger::setupContextMenu(QMenu* menu, QObject* receiver, const } ViewProvider *ViewProviderDragger::startEditing(int mode) { - _linkDragger = 0; + _linkDragger = nullptr; auto ret = ViewProviderDocumentObject::startEditing(mode); if(!ret) return ret; @@ -103,7 +103,7 @@ bool ViewProviderDragger::checkLink() { // usually by doubleClicked(). If so, we route the request back. There shall // be no risk of infinite recursion, as ViewProviderLink handles // ViewProvider::Transform request by itself. - ViewProviderDocumentObject *vpParent = 0; + ViewProviderDocumentObject *vpParent = nullptr; std::string subname; auto doc = Application::Instance->editDocument(); if(!doc) diff --git a/src/Gui/ViewProviderExtensionPyImp.cpp b/src/Gui/ViewProviderExtensionPyImp.cpp index 5e839881d2..cbd30f4bfc 100644 --- a/src/Gui/ViewProviderExtensionPyImp.cpp +++ b/src/Gui/ViewProviderExtensionPyImp.cpp @@ -83,7 +83,7 @@ PyObject* ViewProviderExtensionPy::ignoreOverlayIcon(PyObject *args) PyObject *ViewProviderExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ViewProviderExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/) diff --git a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp index b55159861a..d52f8ceef4 100644 --- a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp +++ b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp @@ -48,7 +48,7 @@ ViewProviderGeoFeatureGroupExtension::ViewProviderGeoFeatureGroupExtension() ViewProviderGeoFeatureGroupExtension::~ViewProviderGeoFeatureGroupExtension() { pcGroupChildren->unref(); - pcGroupChildren = 0; + pcGroupChildren = nullptr; } diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index 58a4cab228..8c7dd452c7 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -56,8 +56,8 @@ PROPERTY_SOURCE(Gui::ViewProviderGeometryObject, Gui::ViewProviderDragger) const App::PropertyIntegerConstraint::Constraints intPercent = {0,100,1}; ViewProviderGeometryObject::ViewProviderGeometryObject() - : pcBoundSwitch(0) - , pcBoundColor(0) + : pcBoundSwitch(nullptr) + , pcBoundColor(nullptr) { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); bool randomColor = hGrp->GetBool("RandomColor", false); @@ -223,7 +223,7 @@ SoPickedPoint* ViewProviderGeometryObject::getPickedPoint(const SbVec2s& pos, co // returns a copy of the point SoPickedPoint* pick = rp.getPickedPoint(); //return (pick ? pick->copy() : 0); // needs the same instance of CRT under MS Windows - return (pick ? new SoPickedPoint(*pick) : 0); + return (pick ? new SoPickedPoint(*pick) : nullptr); } unsigned long ViewProviderGeometryObject::getBoundColor() const diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 2f39d945ed..858d73d202 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -135,7 +135,7 @@ public: return static_cast(vp); } } - return 0; + return nullptr; } static Pointer get(App::DocumentObject *obj, Gui::LinkOwner *owner) { @@ -255,11 +255,11 @@ public: coinRemoveAllChildren(pcChildGroup); pcChildGroup.reset(); } - pcLinked = 0; + pcLinked = nullptr; connChangeIcon.disconnect(); } - void updateSwitch(SoSwitch *node=0) { + void updateSwitch(SoSwitch *node=nullptr) { if(!isLinked() || !pcLinkedSwitch) return; int index = pcLinkedSwitch->whichChild.getValue(); for(size_t i=0;i=LinkView::SnapshotMax) - return 0; + return nullptr; SoSeparator *root; if(!isLinked() || !(root=pcLinked->getRoot())) - return 0; + return nullptr; if(sensor.getAttachedNode()!=root) { sensor.detach(); @@ -408,7 +408,7 @@ public: if(switchSensor.getAttachedNode() != pcLinkedSwitch) { switchSensor.detach(); switchSensor.attach(pcLinkedSwitch); - pcUpdateSwitch = 0; + pcUpdateSwitch = nullptr; } pcSnapshot->addChild(pcModeSwitch); @@ -465,7 +465,7 @@ public: NodeMap nodeMap; for(auto child : pcLinked->claimChildren3D()) { - Pointer info = get(child,0); + Pointer info = get(child,nullptr); if(!info) continue; SoNode *node = info->getSnapshot(LinkView::SnapshotChild); if(!node) continue; @@ -919,7 +919,7 @@ Base::BoundBox3d LinkView::getBoundBox(ViewProviderDocumentObject *vpd) const { ViewProviderDocumentObject *LinkView::getOwner() const { if(linkOwner && linkOwner->isLinked()) return linkOwner->pcLinked; - return 0; + return nullptr; } void LinkView::setOwner(ViewProviderDocumentObject *vpd) { @@ -984,7 +984,7 @@ void LinkView::setMaterial(int index, const App::Material *material) { c.a = material->transparency; pcLinkRoot->setColorOverride(c); for(int i=0;i= (int)nodeArray.size()) LINK_THROW(Base::ValueError,"LinkView: material index out of range"); else { @@ -1240,7 +1240,7 @@ ViewProviderDocumentObject *LinkView::getLinkedView() const { auto link = linkInfo; if(autoSubLink && subInfo.size()==1) link = subInfo.begin()->second->linkInfo; - return link?link->pcLinked:0; + return link?link->pcLinked:nullptr; } std::vector LinkView::getSubNames() const { @@ -1273,7 +1273,7 @@ void LinkView::setNodeType(SnapshotType type, bool sublink) { if(isLinked()) replaceLinkedRoot(linkInfo->getSnapshot(type)); else - replaceLinkedRoot(0); + replaceLinkedRoot(nullptr); } nodeType = type; updateLink(); @@ -1365,7 +1365,7 @@ void LinkView::updateLink() { auto &sub = *v.second; Base::Matrix4D mat; App::DocumentObject *sobj = obj->getSubObject( - v.first.c_str(), 0, &mat, nodeType==SnapshotContainer); + v.first.c_str(), nullptr, &mat, nodeType==SnapshotContainer); if(!sobj) { sub.unlink(); continue; @@ -1380,7 +1380,7 @@ void LinkView::updateLink() { SoSelectionElementAction action(SoSelectionElementAction::Append,true); for(const auto &subelement : sub.subElements) { path.truncate(2); - SoDetail *det = 0; + SoDetail *det = nullptr; if(!sub.linkInfo->getDetail(false,SnapshotTransform,subelement.c_str(),det,&path)) continue; action.setElement(det); @@ -1596,7 +1596,7 @@ static const char *_LinkElementIcon = "LinkElement"; ViewProviderLink::ViewProviderLink() :linkType(LinkTypeNone),hasSubName(false),hasSubElement(false) - ,useCenterballDragger(false),childVp(0),overlayCacheKey(0) + ,useCenterballDragger(false),childVp(nullptr),overlayCacheKey(0) { sPixmap = _LinkIcon; @@ -1610,7 +1610,7 @@ ViewProviderLink::ViewProviderLink() ShapeMaterial.setStatus(App::Property::MaterialEdit, true); ADD_PROPERTY_TYPE(DrawStyle,((long int)0), " Link", App::Prop_None, ""); - static const char* DrawStyleEnums[]= {"None","Solid","Dashed","Dotted","Dashdot",NULL}; + static const char* DrawStyleEnums[]= {"None","Solid","Dashed","Dotted","Dashdot",nullptr}; DrawStyle.setEnums(DrawStyleEnums); int lwidth = ViewParams::instance()->getDefaultShapeLineWidth(); @@ -1650,7 +1650,7 @@ void ViewProviderLink::attach(App::DocumentObject *pcObj) { node->setName(pcObj->getFullName().c_str()); addDisplayMaskMode(node,"Link"); if(childVp) { - childVpLink = LinkInfo::get(childVp,0); + childVpLink = LinkInfo::get(childVp,nullptr); node = childVpLink->getSnapshot(LinkView::SnapshotTransform); } addDisplayMaskMode(node,"ChildView"); @@ -1722,7 +1722,7 @@ void ViewProviderLink::onChanged(const App::Property* prop) { childVp->updateView(); childVp->setActiveMode(); if(pcModeSwitch->getNumChildren()>1){ - childVpLink = LinkInfo::get(childVp,0); + childVpLink = LinkInfo::get(childVp,nullptr); pcModeSwitch->replaceChild(1,childVpLink->getSnapshot(LinkView::SnapshotTransform)); } } @@ -1772,13 +1772,13 @@ bool ViewProviderLink::setLinkType(App::LinkBaseExtension *ext) { App::LinkBaseExtension *ViewProviderLink::getLinkExtension() { if(!pcObject || !pcObject->getNameInDocument()) - return 0; + return nullptr; return pcObject->getExtensionByType(true); } const App::LinkBaseExtension *ViewProviderLink::getLinkExtension() const{ if(!pcObject || !pcObject->getNameInDocument()) - return 0; + return nullptr; return const_cast(pcObject)->getExtensionByType(true); } @@ -2012,9 +2012,9 @@ void ViewProviderLink::applyMaterial() { OverrideMaterialList.getSize()>i && OverrideMaterialList[i]) linkView->setMaterial(i,&MaterialList[i]); else - linkView->setMaterial(i,0); + linkView->setMaterial(i,nullptr); } - linkView->setMaterial(-1,0); + linkView->setMaterial(-1,nullptr); } } @@ -2071,7 +2071,7 @@ ViewProvider *ViewProviderLink::getLinkedView( getObject()->getLinkedObject(true); if(obj && obj!=getObject()) return Application::Instance->getViewProvider(obj); - return 0; + return nullptr; } std::vector ViewProviderLink::claimChildren(void) const { @@ -2126,7 +2126,7 @@ void ViewProviderLink::dragObject(App::DocumentObject* obj) { const auto &objs = ext->getElementListValue(); for(size_t i=0;isetLink(i,0); + ext->setLink(i,nullptr); break; } } @@ -2212,9 +2212,9 @@ std::string ViewProviderLink::dropObjectEx(App::DocumentObject* obj, else ext->setLink(-1,owner,subname); } else if(ext->getSubElements().size()) - ext->setLink(-1,obj,0,subElements); + ext->setLink(-1,obj,nullptr,subElements); else - ext->setLink(-1,obj,0); + ext->setLink(-1,obj,nullptr); return std::string(); } @@ -2249,7 +2249,7 @@ bool ViewProviderLink::getElementPicked(const SoPickedPoint *pp, std::string &su if(!ret) return ret; if(isGroup(ext,true)) { - const char *sub = 0; + const char *sub = nullptr; int idx = App::LinkBaseExtension::getArrayIndex(subname.c_str(),&sub); if(idx>=0 ) { --sub; @@ -2419,7 +2419,7 @@ bool ViewProviderLink::initDraggingPlacement() { // the dragger is meant to change our transformation. dragCtx->preTransform *= pla.inverse().toMatrix(); - dragCtx->bbox = getBoundingBox(0,false); + dragCtx->bbox = getBoundingBox(nullptr,false); // The returned bounding box is before our own transform, but we still need // to scale it to get the correct center. auto scale = ext->getScaleVector(); @@ -2437,7 +2437,7 @@ bool ViewProviderLink::initDraggingPlacement() { && ((ext->getLinkedObjectValue() && !linkView->hasSubs()) || modifier == Qt::ControlModifier)) { - App::PropertyPlacement *propPla = 0; + App::PropertyPlacement *propPla = nullptr; if(ext->getLinkTransformValue() && ext->getLinkedObjectValue()) { propPla = Base::freecad_dynamic_cast( ext->getLinkedObjectValue()->getPropertyByName("Placement")); @@ -2484,7 +2484,7 @@ ViewProvider *ViewProviderLink::startEditing(int mode) { doc->setEditingTransform(_editingTransform); if(!initDraggingPlacement()) - return 0; + return nullptr; if(useCenterballDragger) pcDragger = CoinPtr(new SoCenterballDragger); else @@ -2498,7 +2498,7 @@ ViewProvider *ViewProviderLink::startEditing(int mode) { if(!linkEdit()) { FC_ERR("unsupported edit mode " << mode); - return 0; + return nullptr; } // TODO: the 0x8000 mask here is for caller to disambiguate the intention @@ -2510,7 +2510,7 @@ ViewProvider *ViewProviderLink::startEditing(int mode) { if(!doc) { FC_ERR("no editing document"); - return 0; + return nullptr; } // We are forwarding the editing request to linked object. We need to @@ -2519,13 +2519,13 @@ ViewProvider *ViewProviderLink::startEditing(int mode) { auto linked = getObject()->getLinkedObject(true,&mat,false); if(!linked || linked==getObject()) { FC_ERR("no linked object"); - return 0; + return nullptr; } auto vpd = freecad_dynamic_cast( Application::Instance->getViewProvider(linked)); if(!vpd) { FC_ERR("no linked viewprovider"); - return 0; + return nullptr; } // Amend the editing transformation with the link transformation. // But save it first in case the linked object reroute the editing request @@ -2902,8 +2902,8 @@ std::map ViewProviderLink::getElementColors(const char } std::map ret; for(auto &v : colors) { - const char *pos = 0; - auto sobj = getObject()->resolve(v.first.c_str(),0,0,&pos); + const char *pos = nullptr; + auto sobj = getObject()->resolve(v.first.c_str(),nullptr,nullptr,&pos); if(!sobj || !pos) continue; auto link = sobj->getLinkedObject(true); @@ -3011,8 +3011,8 @@ void ViewProviderLink::applyColors() { colors.erase("Face"); for(auto &v : colors) { const char *subname = v.first.c_str(); - const char *element = 0; - auto sobj = getObject()->resolve(subname,0,0,&element); + const char *element = nullptr; + auto sobj = getObject()->resolve(subname,nullptr,nullptr,&element); if(!sobj || !element) continue; if(ViewProvider::hiddenMarker() == element) @@ -3029,7 +3029,7 @@ void ViewProviderLink::applyColors() { action.apply(linkView->getLinkRoot()); continue; } - SoDetail *det=0; + SoDetail *det=nullptr; path.truncate(0); if(getDetailPath(v.first.c_str(), &path, false, det)) action.apply(&path); @@ -3038,7 +3038,7 @@ void ViewProviderLink::applyColors() { action.setType(SoSelectionElementAction::Hide); for(auto &sub : hideList) { - SoDetail *det=0; + SoDetail *det=nullptr; path.truncate(0); if(sub.size() && getDetailPath(sub.c_str(), &path, false, det)) action.apply(&path); @@ -3065,7 +3065,7 @@ void ViewProviderLink::onBeforeChange(const App::Property *prop) { childVp->beforeDelete(); pcModeSwitch->replaceChild(1,linkView->getLinkRoot()); childVpLink.reset(); - childVp = 0; + childVp = nullptr; } } inherited::onBeforeChange(prop); @@ -3085,10 +3085,10 @@ App::Property *ViewProviderLink::getPropertyByName(const char *name) const { prop = childVp->getPropertyByName(name); if(prop && !prop->testStatus(App::Property::Hidden)) return prop; - prop = 0; + prop = nullptr; } if(pcObject && pcObject->canLinkProperties()) { - auto linked = getLinkedViewProvider(0,true); + auto linked = getLinkedViewProvider(nullptr,true); if(linked && linked!=this) prop = linked->getPropertyByName(name); } @@ -3126,7 +3126,7 @@ ViewProviderDocumentObject *ViewProviderLink::getLinkedViewProvider( auto ext = getLinkExtension(); if(!ext) return self; - App::DocumentObject *linked = 0; + App::DocumentObject *linked = nullptr; if(!recursive) { linked = ext->getLink(); const char *s = ext->getSubName(); diff --git a/src/Gui/ViewProviderLink.h b/src/Gui/ViewProviderLink.h index b0e2c7996a..e6fc04a44a 100644 --- a/src/Gui/ViewProviderLink.h +++ b/src/Gui/ViewProviderLink.h @@ -146,7 +146,7 @@ public: std::vector getSubNames() const; ViewProviderDocumentObject *getLinkedView() const; - Base::BoundBox3d getBoundBox(ViewProviderDocumentObject *vpd=0) const; + Base::BoundBox3d getBoundBox(ViewProviderDocumentObject *vpd=nullptr) const; void setInvalid(); @@ -247,7 +247,7 @@ public: void enableCenterballDragger(bool enable); bool isUsingCenterballDragger() const { return useCenterballDragger; } - std::map getElementColors(const char *subname=0) const override; + std::map getElementColors(const char *subname=nullptr) const override; void setElementColors(const std::map &colors) override; void setOverrideMode(const std::string &mode) override; @@ -262,7 +262,7 @@ public: virtual void getPropertyList(std::vector &List) const override; virtual ViewProviderDocumentObject *getLinkedViewProvider( - std::string *subname=0, bool recursive=false) const override; + std::string *subname=nullptr, bool recursive=false) const override; virtual bool allowOverride(const App::DocumentObject &) const override { return true; @@ -272,7 +272,7 @@ protected: bool setEdit(int ModNum) override; void setEditViewer(View3DInventorViewer*, int ModNum) override; void unsetEditViewer(View3DInventorViewer*) override; - bool linkEdit(const App::LinkBaseExtension *ext=0) const; + bool linkEdit(const App::LinkBaseExtension *ext=nullptr) const; enum LinkType { LinkTypeNone, @@ -280,8 +280,8 @@ protected: LinkTypeSubs, }; - bool hasElements(const App::LinkBaseExtension *ext = 0) const; - bool isGroup(const App::LinkBaseExtension *ext=0, bool plainGroup=false) const; + bool hasElements(const App::LinkBaseExtension *ext = nullptr) const; + bool isGroup(const App::LinkBaseExtension *ext=nullptr, bool plainGroup=false) const; const App::LinkBaseExtension *getLinkExtension() const; App::LinkBaseExtension *getLinkExtension(); @@ -296,9 +296,9 @@ protected: void applyMaterial(); void applyColors(); - void checkIcon(const App::LinkBaseExtension *ext=0); + void checkIcon(const App::LinkBaseExtension *ext=nullptr); - ViewProvider *getLinkedView(bool real,const App::LinkBaseExtension *ext=0) const; + ViewProvider *getLinkedView(bool real,const App::LinkBaseExtension *ext=nullptr) const; bool initDraggingPlacement(); bool callDraggerProxy(const char *fname, bool update); diff --git a/src/Gui/ViewProviderLinkPyImp.cpp b/src/Gui/ViewProviderLinkPyImp.cpp index 689266aa26..7b19ada206 100644 --- a/src/Gui/ViewProviderLinkPyImp.cpp +++ b/src/Gui/ViewProviderLinkPyImp.cpp @@ -75,7 +75,7 @@ Py::Object ViewProviderLinkPy::getLinkView() const { PyObject *ViewProviderLinkPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ViewProviderLinkPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Gui/ViewProviderMeasureDistance.cpp b/src/Gui/ViewProviderMeasureDistance.cpp index 3eba30a137..bfec18944e 100644 --- a/src/Gui/ViewProviderMeasureDistance.cpp +++ b/src/Gui/ViewProviderMeasureDistance.cpp @@ -337,7 +337,7 @@ void ViewProviderMeasureDistance::measureDistanceCallback(void * ud, SoEventCall if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { const SoPickedPoint * point = n->getPickedPoint(); - if (point == NULL) { + if (point == nullptr) { Base::Console().Message("No point picked.\n"); return; } diff --git a/src/Gui/ViewProviderOrigin.cpp b/src/Gui/ViewProviderOrigin.cpp index 146dbfdfa7..a04e063a6f 100644 --- a/src/Gui/ViewProviderOrigin.cpp +++ b/src/Gui/ViewProviderOrigin.cpp @@ -63,7 +63,7 @@ ViewProviderOrigin::ViewProviderOrigin() ViewProviderOrigin::~ViewProviderOrigin() { pcGroupChildren->unref(); - pcGroupChildren = 0; + pcGroupChildren = nullptr; } std::vector ViewProviderOrigin::claimChildren(void) const { diff --git a/src/Gui/ViewProviderOriginGroupExtension.cpp b/src/Gui/ViewProviderOriginGroupExtension.cpp index e26300190d..3a59f02aa1 100644 --- a/src/Gui/ViewProviderOriginGroupExtension.cpp +++ b/src/Gui/ViewProviderOriginGroupExtension.cpp @@ -147,8 +147,8 @@ void ViewProviderOriginGroupExtension::updateOriginSize () { return; // obtain an Origin and it's ViewProvider - App::Origin* origin = 0; - Gui::ViewProviderOrigin* vpOrigin = 0; + App::Origin* origin = nullptr; + Gui::ViewProviderOrigin* vpOrigin = nullptr; try { origin = group->getOrigin (); assert (origin); diff --git a/src/Gui/ViewProviderPyImp.cpp b/src/Gui/ViewProviderPyImp.cpp index e76360f118..a7c94f3869 100644 --- a/src/Gui/ViewProviderPyImp.cpp +++ b/src/Gui/ViewProviderPyImp.cpp @@ -61,7 +61,7 @@ std::string ViewProviderPy::representation(void) const PyObject* ViewProviderPy::addProperty(PyObject *args) { - char *sType,*sName=0,*sGroup=0,*sDoc=0; + char *sType,*sName=nullptr,*sGroup=nullptr,*sDoc=nullptr; short attr=0; std::string sDocStr; PyObject *ro = Py_False, *hd = Py_False; @@ -74,7 +74,7 @@ PyObject* ViewProviderPy::addProperty(PyObject *args) PyMem_Free(sDoc); } - App::Property* prop=0; + App::Property* prop=nullptr; try { prop = getViewProviderPtr()->addDynamicProperty(sType,sName,sGroup,sDocStr.c_str(),attr, PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false); @@ -177,7 +177,7 @@ PyObject* ViewProviderPy::canDropObject(PyObject *args) PyObject *obj = Py_None; PyObject *owner = Py_None; PyObject *pyElements = Py_None; - const char *subname = 0; + const char *subname = nullptr; if (!PyArg_ParseTuple(args, "|OOsO", &obj,&owner,&subname,&pyElements)) return nullptr; PY_TRY { @@ -216,7 +216,7 @@ PyObject* ViewProviderPy::canDragAndDropObject(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &App::DocumentObjectPy::Type,&obj)) - return NULL; + return nullptr; PY_TRY { bool ret = getViewProviderPtr()->canDragAndDropObject( static_cast(obj)->getDocumentObjectPtr()); @@ -229,15 +229,15 @@ PyObject* ViewProviderPy::dropObject(PyObject *args) PyObject *obj; PyObject *owner = Py_None; PyObject *pyElements = Py_None; - const char *subname = 0; + const char *subname = nullptr; if (!PyArg_ParseTuple(args, "O!|OsO", &App::DocumentObjectPy::Type,&obj,&owner,&subname,&pyElements)) - return NULL; + return nullptr; PY_TRY { - App::DocumentObject *pcOwner = 0; + App::DocumentObject *pcOwner = nullptr; if(owner!=Py_None) { if(!PyObject_TypeCheck(owner,&App::DocumentObjectPy::Type)) { PyErr_SetString(PyExc_TypeError, "exepcting 'owner' to be of type DocumentObject"); - return NULL; + return nullptr; } pcOwner = static_cast(owner)->getDocumentObjectPtr(); } @@ -247,7 +247,7 @@ PyObject* ViewProviderPy::dropObject(PyObject *args) elements.setPyObject(pyElements); }catch(...) { PyErr_SetString(PyExc_TypeError, "exepcting the forth argument to be of type sequence of strings"); - return 0; + return nullptr; } } auto ret = getViewProviderPtr()->dropObjectEx( @@ -261,7 +261,7 @@ PyObject* ViewProviderPy::dragObject(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &App::DocumentObjectPy::Type,&obj)) - return NULL; + return nullptr; PY_TRY { getViewProviderPtr()->dragObject( static_cast(obj)->getDocumentObjectPtr()); @@ -276,7 +276,7 @@ PyObject* ViewProviderPy::replaceObject(PyObject *args) if (!PyArg_ParseTuple(args, "O!O!", &App::DocumentObjectPy::Type,&oldObj, &App::DocumentObjectPy::Type,&newObj)) - return NULL; + return nullptr; PY_TRY { int ret = getViewProviderPtr()->replaceObject( static_cast(oldObj)->getDocumentObjectPtr(), @@ -290,15 +290,15 @@ PyObject* ViewProviderPy::addDisplayMode(PyObject * args) char* mode; PyObject* obj; if (!PyArg_ParseTuple(args, "Os", &obj, &mode)) - return NULL; + return nullptr; - void* ptr = 0; + void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin","_p_SoNode", obj, &ptr, 0); } catch (const Base::Exception& e) { PyErr_SetString(PyExc_RuntimeError, e.what()); - return 0; + return nullptr; } PY_TRY { @@ -353,7 +353,7 @@ PyObject* ViewProviderPy::setTransformation(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Either set matrix or placement to set transformation"); - return 0; + return nullptr; } PyObject* ViewProviderPy::claimChildren(PyObject* args) @@ -381,13 +381,13 @@ PyObject* ViewProviderPy::partialRender(PyObject* args) std::vector values; if(value != Py_None) { - PyObject *item = 0; + PyObject *item = nullptr; Py_ssize_t nSize; if (PyList_Check(value) || PyTuple_Check(value)) nSize = PySequence_Size(value); else { item = value; - value = 0; + value = nullptr; nSize = 1; } values.resize(nSize); @@ -411,7 +411,7 @@ PyObject* ViewProviderPy::partialRender(PyObject* args) PyObject* ViewProviderPy::getElementColors(PyObject* args) { - const char *element = 0; + const char *element = nullptr; if (!PyArg_ParseTuple(args, "|s", &element)) return nullptr; @@ -476,7 +476,7 @@ PyObject* ViewProviderPy::getDetailPath(PyObject* args) SoPath *pPath = reinterpret_cast(ptr); if(!pPath) throw Base::TypeError("type must be of coin.SoPath"); - SoDetail *det = 0; + SoDetail *det = nullptr; if(!getViewProviderPtr()->getDetailPath( sub,static_cast(pPath),PyObject_IsTrue(append),det)) { @@ -503,7 +503,7 @@ PyObject *ViewProviderPy::getBoundingBox(PyObject *args) { if (!PyArg_ParseTuple(args, "|sOO!", &subname,&transform,View3DInventorPy::type_object(),&pyView)) return nullptr; PY_TRY { - View3DInventor *view = 0; + View3DInventor *view = nullptr; if(pyView) view = static_cast(pyView)->getView3DIventorPtr(); auto bbox = getViewProviderPtr()->getBoundingBox(subname,PyObject_IsTrue(transform),view); diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index cf77dbf72c..3de75aad5f 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -427,7 +427,7 @@ bool ViewProviderPythonFeatureImp::getElement(const SoDetail *det, std::string & // Run the onChanged method of the proxy object. Base::PyGILStateLocker lock; try { - PyObject* pivy = 0; + PyObject* pivy = nullptr; // Note: As there is no ref'counting mechanism for the SoDetail class we must // pass '0' as the last parameter so that the Python object does not 'own' // the detail object. @@ -460,7 +460,7 @@ ViewProviderPythonFeatureImp::getElementPicked(const SoPickedPoint *pp, std::str Base::PyGILStateLocker lock; try { - PyObject* pivy = 0; + PyObject* pivy = nullptr; pivy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoPickedPoint *", (void*)pp, 0); Py::Tuple args(1); args.setItem(0, Py::Object(pivy, true)); @@ -494,10 +494,10 @@ bool ViewProviderPythonFeatureImp::getDetail(const char* name, SoDetail *&det) c Py::Tuple args(1); args.setItem(0, Py::String(name)); Py::Object pydet(Base::pyCall(py_getDetail.ptr(),args.ptr())); - void* ptr = 0; + void* ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDetail *", pydet.ptr(), &ptr, 0); SoDetail* detail = reinterpret_cast(ptr); - det = detail ? detail->copy() : 0; + det = detail ? detail->copy() : nullptr; return true; } catch (const Base::Exception& e) { @@ -523,7 +523,7 @@ ViewProviderPythonFeatureImp::ValueT ViewProviderPythonFeatureImp::getDetailPath Base::PyGILStateLocker lock; auto length = path->getLength(); try { - PyObject* pivy = 0; + PyObject* pivy = nullptr; pivy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoFullPath *", (void*)path, 1); path->ref(); Py::Tuple args(3); @@ -535,10 +535,10 @@ ViewProviderPythonFeatureImp::ValueT ViewProviderPythonFeatureImp::getDetailPath return Rejected; if(pyDet.isBoolean()) return Accepted; - void* ptr = 0; + void* ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDetail *", pyDet.ptr(), &ptr, 0); SoDetail* detail = reinterpret_cast(ptr); - det = detail ? detail->copy() : 0; + det = detail ? detail->copy() : nullptr; if(det) return Accepted; delete det; diff --git a/src/Gui/ViewProviderPythonFeature.h b/src/Gui/ViewProviderPythonFeature.h index e04f737d5d..1c190dbfd7 100644 --- a/src/Gui/ViewProviderPythonFeature.h +++ b/src/Gui/ViewProviderPythonFeature.h @@ -266,7 +266,7 @@ public: return name; } virtual SoDetail* getDetail(const char* name) const override { - SoDetail *det = 0; + SoDetail *det = nullptr; if(imp->getDetail(name,det)) return det; return ViewProviderT::getDetail(name); @@ -570,8 +570,8 @@ protected: } virtual ViewProviderDocumentObject *getLinkedViewProvider( - std::string *subname=0, bool recursive=false) const override{ - ViewProviderDocumentObject *res = 0; + std::string *subname=nullptr, bool recursive=false) const override{ + ViewProviderDocumentObject *res = nullptr; if(!imp->getLinkedViewProvider(res, subname, recursive)) res = ViewProviderT::getLinkedViewProvider(subname,recursive); return res; diff --git a/src/Gui/WaitCursor.cpp b/src/Gui/WaitCursor.cpp index 0806b480f9..44d0262a55 100644 --- a/src/Gui/WaitCursor.cpp +++ b/src/Gui/WaitCursor.cpp @@ -58,9 +58,9 @@ private: }; } // namespace Gui -WaitCursorP* WaitCursorP::_instance = 0; +WaitCursorP* WaitCursorP::_instance = nullptr; -WaitCursorP::WaitCursorP() : QObject(0), isOn(false), flags(WaitCursor::AllEvents) +WaitCursorP::WaitCursorP() : QObject(nullptr), isOn(false), flags(WaitCursor::AllEvents) { } diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 866a1dda83..f866331e15 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -300,14 +300,14 @@ void ActionSelector::onItemDoubleClicked(QTreeWidgetItem * item, int column) if (treeWidget == availableWidget) { int index = availableWidget->indexOfTopLevelItem(item); item = availableWidget->takeTopLevelItem(index); - availableWidget->setCurrentItem(0); + availableWidget->setCurrentItem(nullptr); selectedWidget->addTopLevelItem(item); selectedWidget->setCurrentItem(item); } else if (treeWidget == selectedWidget) { int index = selectedWidget->indexOfTopLevelItem(item); item = selectedWidget->takeTopLevelItem(index); - selectedWidget->setCurrentItem(0); + selectedWidget->setCurrentItem(nullptr); availableWidget->addTopLevelItem(item); availableWidget->setCurrentItem(item); } @@ -319,7 +319,7 @@ void ActionSelector::on_addButton_clicked() if (item) { int index = availableWidget->indexOfTopLevelItem(item); item = availableWidget->takeTopLevelItem(index); - availableWidget->setCurrentItem(0); + availableWidget->setCurrentItem(nullptr); selectedWidget->addTopLevelItem(item); selectedWidget->setCurrentItem(item); } @@ -331,7 +331,7 @@ void ActionSelector::on_removeButton_clicked() if (item) { int index = selectedWidget->indexOfTopLevelItem(item); item = selectedWidget->takeTopLevelItem(index); - selectedWidget->setCurrentItem(0); + selectedWidget->setCurrentItem(nullptr); availableWidget->addTopLevelItem(item); availableWidget->setCurrentItem(item); } @@ -630,7 +630,7 @@ struct ColorButtonP bool dirty; ColorButtonP() - : cd(0) + : cd(nullptr) , allowChange(true) , autoChange(false) , drawFrame(true) @@ -1131,7 +1131,7 @@ void LabelButton::browse() // ---------------------------------------------------------------------- -ToolTip* ToolTip::inst = 0; +ToolTip* ToolTip::inst = nullptr; ToolTip* ToolTip::instance() { diff --git a/src/Gui/Widgets.h b/src/Gui/Widgets.h index 6e346c2fc1..37cfc637e4 100644 --- a/src/Gui/Widgets.h +++ b/src/Gui/Widgets.h @@ -63,7 +63,7 @@ class CommandIconView : public QListWidget Q_OBJECT public: - CommandIconView (QWidget * parent = 0); + CommandIconView (QWidget * parent = nullptr); virtual ~CommandIconView (); protected: @@ -84,7 +84,7 @@ class GuiExport ActionSelector : public QWidget Q_OBJECT public: - ActionSelector(QWidget* parent=0); + ActionSelector(QWidget* parent=nullptr); ~ActionSelector(); QTreeWidget* availableTreeWidget() const @@ -137,7 +137,7 @@ class GuiExport AccelLineEdit : public QLineEdit Q_OBJECT public: - AccelLineEdit(QWidget * parent=0); + AccelLineEdit(QWidget * parent=nullptr); bool isNone() const; protected: @@ -157,7 +157,7 @@ class GuiExport ModifierLineEdit : public QLineEdit Q_OBJECT public: - ModifierLineEdit(QWidget * parent=0); + ModifierLineEdit(QWidget * parent=nullptr); protected: void keyPressEvent(QKeyEvent * e); @@ -174,7 +174,7 @@ class GuiExport ClearLineEdit : public QLineEdit Q_OBJECT public: - ClearLineEdit (QWidget * parent=0); + ClearLineEdit (QWidget * parent=nullptr); protected: void resizeEvent(QResizeEvent *); @@ -202,7 +202,7 @@ class GuiExport CheckListDialog : public QDialog Q_OBJECT public: - CheckListDialog( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + CheckListDialog( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~CheckListDialog(); void setCheckableItems( const QStringList& items ); @@ -232,7 +232,7 @@ class GuiExport ColorButton : public QPushButton Q_PROPERTY( bool allowTransparency READ allowTransparency WRITE setAllowTransparency) public: - ColorButton(QWidget* parent = 0); + ColorButton(QWidget* parent = nullptr); ~ColorButton(); void setColor(const QColor&); @@ -288,7 +288,7 @@ class GuiExport UrlLabel : public QLabel Q_PROPERTY( bool launchExternal READ launchExternal WRITE setLaunchExternal) public: - UrlLabel ( QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags() ); + UrlLabel ( QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); virtual ~UrlLabel(); QString url() const; @@ -401,7 +401,7 @@ class GuiExport LabelButton : public QWidget Q_PROPERTY(QVariant value READ value WRITE setValue) public: - LabelButton (QWidget * parent = 0); + LabelButton (QWidget * parent = nullptr); virtual ~LabelButton(); QVariant value() const; @@ -441,7 +441,7 @@ private: class GuiExport ToolTip : public QObject { public: - static void showText(const QPoint & pos, const QString & text, QWidget * w = 0); + static void showText(const QPoint & pos, const QString & text, QWidget * w = nullptr); protected: static ToolTip* instance(); @@ -493,7 +493,7 @@ class GuiExport PropertyListEditor : public QPlainTextEdit Q_OBJECT public: - PropertyListEditor(QWidget *parent = 0); + PropertyListEditor(QWidget *parent = nullptr); void lineNumberAreaPaintEvent(QPaintEvent *event); int lineNumberAreaWidth(); @@ -522,7 +522,7 @@ class GuiExport LabelEditor : public QWidget public: enum InputType {String, Float, Integer}; - LabelEditor (QWidget * parent = 0); + LabelEditor (QWidget * parent = nullptr); virtual ~LabelEditor(); /** @@ -570,7 +570,7 @@ class GuiExport ExpLineEdit : public QLineEdit, public ExpressionBinding Q_OBJECT public: - ExpLineEdit ( QWidget * parent=0, bool expressionOnly=false ); + ExpLineEdit ( QWidget * parent=nullptr, bool expressionOnly=false ); void setExpression(std::shared_ptr expr); void bind(const App::ObjectIdentifier &_path); diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index 3484cbf7d3..b59f9d4cb3 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -349,8 +349,8 @@ void Workbench::createLinkMenu(MenuItem *item) { *linkMenu << "Std_LinkMakeGroup" << "Std_LinkMake"; auto &rMgr = Application::Instance->commandManager(); - const char *cmds[] = {"Std_LinkMakeRelative",0,"Std_LinkUnlink","Std_LinkReplace", - "Std_LinkImport","Std_LinkImportAll",0,"Std_LinkSelectLinked", + const char *cmds[] = {"Std_LinkMakeRelative",nullptr,"Std_LinkUnlink","Std_LinkReplace", + "Std_LinkImport","Std_LinkImportAll",nullptr,"Std_LinkSelectLinked", "Std_LinkSelectLinkedFinal","Std_LinkSelectAllLinks"}; bool separator = true; for(size_t i=0;isetName( sName ); diff --git a/src/Gui/WorkbenchManager.cpp b/src/Gui/WorkbenchManager.cpp index d795f0c03e..8e5c977785 100644 --- a/src/Gui/WorkbenchManager.cpp +++ b/src/Gui/WorkbenchManager.cpp @@ -33,11 +33,11 @@ using namespace Gui; -WorkbenchManager* WorkbenchManager::_instance = 0; +WorkbenchManager* WorkbenchManager::_instance = nullptr; WorkbenchManager* WorkbenchManager::instance() { - if (_instance == 0) + if (_instance == nullptr) _instance = new WorkbenchManager; return _instance; } @@ -45,10 +45,10 @@ WorkbenchManager* WorkbenchManager::instance() void WorkbenchManager::destruct() { delete _instance; - _instance = 0; + _instance = nullptr; } -WorkbenchManager::WorkbenchManager() : _activeWorkbench(0) +WorkbenchManager::WorkbenchManager() : _activeWorkbench(nullptr) { } @@ -100,14 +100,14 @@ void WorkbenchManager::removeWorkbench(const std::string& name) Workbench* wb = it->second; _workbenches.erase(it); if (_activeWorkbench == wb) - _activeWorkbench = 0; + _activeWorkbench = nullptr; delete wb; } } Workbench* WorkbenchManager::getWorkbench (const std::string& name) const { - Workbench* wb=0; + Workbench* wb=nullptr; std::map::const_iterator it = _workbenches.find(name); if (it != _workbenches.end()) { diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 9d3d026ab8..fb12f727dd 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -279,7 +279,7 @@ void PropertyEditor::openEditor(const QModelIndex &index) str << tr("Edit").toUtf8().constData() << ' '; for(auto prop : items) { if(prop->getContainer()!=obj) { - obj = 0; + obj = nullptr; break; } } @@ -776,7 +776,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent *) { if(res.size()) { std::string group = res.toUtf8().constData(); for(auto prop : props) - prop->getContainer()->changeDynamicProperty(prop,group.c_str(),0); + prop->getContainer()->changeDynamicProperty(prop,group.c_str(),nullptr); buildUp(PropertyModel::PropertyList(propList),checkDocument); } return; diff --git a/src/Gui/propertyeditor/PropertyEditor.h b/src/Gui/propertyeditor/PropertyEditor.h index e61ff0f26a..3e6c3c9585 100644 --- a/src/Gui/propertyeditor/PropertyEditor.h +++ b/src/Gui/propertyeditor/PropertyEditor.h @@ -66,7 +66,7 @@ class PropertyEditor : public QTreeView Q_PROPERTY(QColor groupTextColor READ groupTextColor WRITE setGroupTextColor DESIGNABLE true SCRIPTABLE true) public: - PropertyEditor(QWidget *parent = 0); + PropertyEditor(QWidget *parent = nullptr); ~PropertyEditor(); /** Builds up the list view with the properties. */ diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index f3efc542a1..0abc1f1c07 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -62,11 +62,11 @@ using namespace Gui::PropertyEditor; using namespace Gui::Dialog; -Gui::PropertyEditor::PropertyItemFactory* Gui::PropertyEditor::PropertyItemFactory::_singleton = NULL; +Gui::PropertyEditor::PropertyItemFactory* Gui::PropertyEditor::PropertyItemFactory::_singleton = nullptr; PropertyItemFactory& PropertyItemFactory::instance() { - if (_singleton == NULL) + if (_singleton == nullptr) _singleton = new PropertyItemFactory; return *_singleton; } @@ -74,7 +74,7 @@ PropertyItemFactory& PropertyItemFactory::instance() void PropertyItemFactory::destruct () { delete _singleton; - _singleton = 0; + _singleton = nullptr; } PropertyItem* PropertyItemFactory::createPropertyItem (const char* sName) const @@ -96,7 +96,7 @@ Q_DECLARE_METATYPE(Py::Object) PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyItem) -PropertyItem::PropertyItem() : parentItem(0), readonly(false), linked(false), expanded(false) +PropertyItem::PropertyItem() : parentItem(nullptr), readonly(false), linked(false), expanded(false) { precision = Base::UnitsApi::getDecimals(); setAutoApply(true); @@ -212,14 +212,14 @@ bool PropertyItem::removeProperty(const App::Property* prop) App::Property* PropertyItem::getFirstProperty() { if (propertyItems.empty()) - return 0; + return nullptr; return propertyItems.front(); } const App::Property* PropertyItem::getFirstProperty() const { if (propertyItems.empty()) - return 0; + return nullptr; return propertyItems.front(); } @@ -437,7 +437,7 @@ void PropertyItem::setValue(const QVariant& /*value*/) QWidget* PropertyItem::createEditor(QWidget* /*parent*/, const QObject* /*receiver*/, const char* /*method*/) const { - return 0; + return nullptr; } void PropertyItem::setEditorData(QWidget * /*editor*/, const QVariant& /*data*/) const @@ -452,7 +452,7 @@ QVariant PropertyItem::editorData(QWidget * /*editor*/) const QWidget* PropertyItem::createExpressionEditor(QWidget* parent, const QObject* receiver, const char* method) const { if(!isBound()) - return 0; + return nullptr; ExpLineEdit *le = new ExpLineEdit(parent,true); le->setFrame(false); le->setReadOnly(true); @@ -850,7 +850,7 @@ QWidget* PropertySeparatorItem::createEditor(QWidget* parent, const QObject* rec Q_UNUSED(parent); Q_UNUSED(receiver); Q_UNUSED(method); - return 0; + return nullptr; } // -------------------------------------------------------------------- @@ -968,7 +968,7 @@ void PropertyIntegerConstraintItem::setEditorData(QWidget *editor, const QVarian const App::PropertyIntegerConstraint* prop = static_cast (getFirstProperty()); - const App::PropertyIntegerConstraint::Constraints* c = 0; + const App::PropertyIntegerConstraint::Constraints* c = nullptr; if (prop) { c = prop->getConstraints(); } @@ -1167,7 +1167,7 @@ void PropertyUnitConstraintItem::setEditorData(QWidget *editor, const QVariant& const App::PropertyQuantityConstraint* prop = static_cast (getFirstProperty()); - const App::PropertyQuantityConstraint::Constraints* c = 0; + const App::PropertyQuantityConstraint::Constraints* c = nullptr; if (prop) { c = prop->getConstraints(); } @@ -1239,7 +1239,7 @@ void PropertyFloatConstraintItem::setEditorData(QWidget *editor, const QVariant& const App::PropertyFloatConstraint* prop = static_cast (getFirstProperty()); - const App::PropertyFloatConstraint::Constraints* c = 0; + const App::PropertyFloatConstraint::Constraints* c = nullptr; if (prop) { c = prop->getConstraints(); } @@ -1346,7 +1346,7 @@ class VectorLineEdit : public Gui::ExpLineEdit { int decimals; public: - VectorLineEdit (int decimals, QWidget * parent=0, bool expressionOnly=false) + VectorLineEdit (int decimals, QWidget * parent=nullptr, bool expressionOnly=false) : Gui::ExpLineEdit(parent, expressionOnly) , decimals(decimals) { @@ -2450,7 +2450,7 @@ void PropertyRotationItem::propertyBound() // -------------------------------------------------------------------- PlacementEditor::PlacementEditor(const QString& name, QWidget * parent) - : LabelButton(parent), _task(0) + : LabelButton(parent), _task(nullptr) { propertyname = name; propertyname.replace(QLatin1String(" "), QLatin1String("")); @@ -2770,7 +2770,7 @@ void PropertyPlacementItem::propertyBound() PROPERTYITEM_SOURCE(Gui::PropertyEditor::PropertyEnumItem) PropertyEnumItem::PropertyEnumItem() - :m_enum(0) + :m_enum(nullptr) { if(PropertyView::showAll()) { m_enum = static_cast(PropertyStringListItem::create()); @@ -2861,7 +2861,7 @@ void PropertyEnumItem::setEditorData(QWidget *editor, const QVariant& data) cons for (std::vector::const_iterator it = items.begin(); it != items.end(); ++it) { if ((*it)->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* prop = static_cast(*it); - if (prop->getEnums() == 0) { + if (prop->getEnums() == nullptr) { commonModes.clear(); break; } @@ -4347,7 +4347,7 @@ void PropertyLinkItem::setValue(const QVariant& value) QWidget* PropertyLinkItem::createEditor(QWidget* parent, const QObject* receiver, const char* method) const { if(propertyItems.empty()) - return 0; + return nullptr; LinkLabel *ll = new LinkLabel(parent, propertyItems.front()); ll->setAutoFillBackground(true); ll->setDisabled(isReadOnly()); @@ -4388,7 +4388,7 @@ PropertyItemEditorFactory::~PropertyItemEditorFactory() QWidget * PropertyItemEditorFactory::createEditor (int /*type*/, QWidget * /*parent*/) const { // do not allow to create any editor widgets because we do that in subclasses of PropertyItem - return 0; + return nullptr; } QByteArray PropertyItemEditorFactory::valuePropertyName (int /*type*/) const diff --git a/src/Gui/propertyeditor/PropertyItem.h b/src/Gui/propertyeditor/PropertyItem.h index 4975774801..6655efe23b 100644 --- a/src/Gui/propertyeditor/PropertyItem.h +++ b/src/Gui/propertyeditor/PropertyItem.h @@ -760,7 +760,7 @@ class PlacementEditor : public Gui::LabelButton Q_OBJECT public: - PlacementEditor(const QString& name, QWidget * parent = 0); + PlacementEditor(const QString& name, QWidget * parent = nullptr); ~PlacementEditor(); private Q_SLOTS: diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index 7f49049c46..3f7be6fce7 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -44,7 +44,7 @@ using namespace Gui::PropertyEditor; PropertyItemDelegate::PropertyItemDelegate(QObject* parent) - : QItemDelegate(parent), expressionEditor(0) + : QItemDelegate(parent), expressionEditor(nullptr) , pressed(false), changed(false) { } @@ -171,23 +171,23 @@ QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOpti const QModelIndex & index ) const { if (!index.isValid()) - return 0; + return nullptr; PropertyItem *childItem = static_cast(index.internalPointer()); if (!childItem) - return 0; + return nullptr; PropertyEditor *parentEditor = qobject_cast(this->parent()); if(parentEditor) parentEditor->closeEditor(); if (childItem->isSeparator()) - return 0; + return nullptr; FC_LOG("create editor " << index.row() << "," << index.column()); QWidget* editor; - expressionEditor = 0; + expressionEditor = nullptr; userEditor = nullptr; if (parentEditor && parentEditor->isBinding()) { expressionEditor = editor = childItem->createExpressionEditor(parent, this, SLOT(valueChanged())); diff --git a/src/Gui/propertyeditor/PropertyModel.cpp b/src/Gui/propertyeditor/PropertyModel.cpp index 6ddc74e487..6f91b9b4dc 100644 --- a/src/Gui/propertyeditor/PropertyModel.cpp +++ b/src/Gui/propertyeditor/PropertyModel.cpp @@ -245,7 +245,7 @@ static PropertyItem *createPropertyItem(App::Property *prop) PropertyModel::GroupInfo &PropertyModel::getGroupInfo(App::Property *prop) { const char* group = prop->getGroup(); - bool isEmpty = (group == 0 || group[0] == '\0'); + bool isEmpty = (group == nullptr || group[0] == '\0'); QString groupName = QString::fromLatin1( isEmpty ? QT_TRANSLATE_NOOP("App::Property", "Base") : group); diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 813492ff9b..5694d4125b 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -97,7 +97,7 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args) PyObject* inThread = Py_False; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &inThread)) - return NULL; + return nullptr; static bool thr = false; if (!qApp) { @@ -105,7 +105,7 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args) thr = true; std::thread t([]() { static int argc = 0; - static char **argv = {0}; + static char **argv = {nullptr}; QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); // This only works well if the QApplication is the very first created instance // of a QObject. Otherwise the application lives in a different thread than the @@ -130,7 +130,7 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args) FilterProc, 0, GetCurrentThreadId()); #elif !defined(QT_NO_GLIB) static int argc = 0; - static char **argv = {0}; + static char **argv = {nullptr}; (void)new QApplication(argc, argv); #else PyErr_SetString(PyExc_RuntimeError, "Must construct a QApplication before a QPaintDevice\n"); @@ -140,13 +140,13 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args) } else if (!qobject_cast(qApp)) { PyErr_SetString(PyExc_RuntimeError, "Cannot create widget when no GUI is being used\n"); - return NULL; + return nullptr; } if (!thr) { if (!setupMainWindow()) { PyErr_SetString(PyExc_RuntimeError, "Cannot create main window\n"); - return NULL; + return nullptr; } } @@ -166,15 +166,15 @@ static PyObject * FreeCADGui_exec_loop(PyObject * /*self*/, PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; if (!qApp) { PyErr_SetString(PyExc_RuntimeError, "Must construct a QApplication before a QPaintDevice\n"); - return NULL; + return nullptr; } else if (!qobject_cast(qApp)) { PyErr_SetString(PyExc_RuntimeError, "Cannot create widget when no GUI is being used\n"); - return NULL; + return nullptr; } qApp->exec(); @@ -187,7 +187,7 @@ static PyObject * FreeCADGui_setupWithoutGUI(PyObject * /*self*/, PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; if (!Gui::Application::Instance) { static Gui::Application *app = new Gui::Application(false); @@ -196,7 +196,7 @@ FreeCADGui_setupWithoutGUI(PyObject * /*self*/, PyObject *args) } else { PyErr_SetString(PyExc_RuntimeError, "FreeCADGui already initialized"); - return 0; + return nullptr; } if (!SoDB::isInitialized()) { @@ -218,12 +218,12 @@ FreeCADGui_embedToWindow(PyObject * /*self*/, PyObject *args) { char* pointer; if (!PyArg_ParseTuple(args, "s", &pointer)) - return NULL; + return nullptr; QWidget* widget = Gui::getMainWindow(); if (!widget) { PyErr_SetString(Base::PyExc_FC_GeneralError, "No main window"); - return 0; + return nullptr; } std::string pointer_str = pointer; @@ -253,7 +253,7 @@ FreeCADGui_embedToWindow(PyObject * /*self*/, PyObject *args) x11->show(); #else PyErr_SetString(PyExc_NotImplementedError, "Not implemented for this platform"); - return 0; + return nullptr; #endif Py_INCREF(Py_None); @@ -272,7 +272,7 @@ struct PyMethodDef FreeCADGui_methods[] = { "an event loop or showing up any GUI\n"}, {"embedToWindow",FreeCADGui_embedToWindow,METH_VARARGS, "embedToWindow() -- Embeds the main window into another window\n"}, - {NULL, NULL, 0, NULL} /* sentinel */ + {nullptr, nullptr, 0, nullptr} /* sentinel */ }; static @@ -288,7 +288,7 @@ QWidget* setupMainWindow() if (hasMainWindow) { // if a main window existed and has been deleted it's not supported // to re-create it - return 0; + return nullptr; } Base::PyGILStateLocker lock; @@ -321,7 +321,7 @@ QWidget* setupMainWindow() } catch (const Base::Exception& e) { PyErr_Format(Base::PyExc_FC_GeneralError, "Error in FreeCADGuiInit.py: %s\n", e.what()); - return 0; + return nullptr; } init = true; } @@ -381,7 +381,7 @@ PyMOD_INIT_FUNC(FreeCADGui) PyModuleDef_HEAD_INIT, "FreeCADGui", "FreeCAD GUI module\n", -1, FreeCADGui_methods, - NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr }; PyObject* module = PyModule_Create(&FreeCADGuiModuleDef); return module; @@ -392,6 +392,6 @@ PyMOD_INIT_FUNC(FreeCADGui) catch (...) { PyErr_SetString(PyExc_ImportError, "Unknown runtime error occurred"); } - return 0; + return nullptr; } diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 854f73e794..077a9654ca 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -222,7 +222,7 @@ int main( int argc, char ** argv ) QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg = QString::fromLatin1(e.what()); QString s = QLatin1String("
") + msg + QLatin1String("
"); - QMessageBox::critical(0, appName, s); + QMessageBox::critical(nullptr, appName, s); exit(1); } catch (const Base::ProgramInformation& e) { @@ -248,7 +248,7 @@ int main( int argc, char ** argv ) "Python is searching for its files in the following directories:\n%3\n\n" "Python version information:\n%4\n") .arg(appName, QString::fromUtf8(e.what()), - QString::fromUtf8(Py_EncodeLocale(Py_GetPath(),NULL)), QString::fromLatin1(Py_GetVersion())); + QString::fromUtf8(Py_EncodeLocale(Py_GetPath(),nullptr)), QString::fromLatin1(Py_GetVersion())); const char* pythonhome = getenv("PYTHONHOME"); if (pythonhome) { msg += QObject::tr("\nThe environment variable PYTHONHOME is set to '%1'.") @@ -259,7 +259,7 @@ int main( int argc, char ** argv ) msg += QObject::tr("\nPlease contact the application's support team for more information.\n\n"); } - QMessageBox::critical(0, QObject::tr("Initialization of %1 failed").arg(appName), msg); + QMessageBox::critical(nullptr, QObject::tr("Initialization of %1 failed").arg(appName), msg); exit(100); } catch (...) { @@ -268,7 +268,7 @@ int main( int argc, char ** argv ) QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg = QObject::tr("Unknown runtime error occurred while initializing %1.\n\n" "Please contact the application's support team for more information.\n\n").arg(appName); - QMessageBox::critical(0, QObject::tr("Initialization of %1 failed").arg(appName), msg); + QMessageBox::critical(nullptr, QObject::tr("Initialization of %1 failed").arg(appName), msg); exit(101); } diff --git a/src/Main/MainPy.cpp b/src/Main/MainPy.cpp index 112c6b8523..52af2ad59a 100644 --- a/src/Main/MainPy.cpp +++ b/src/Main/MainPy.cpp @@ -115,7 +115,7 @@ PyMOD_INIT_FUNC(FreeCAD) if ((ret == 0) || (!info.dli_fname)) { free(argv); PyErr_SetString(PyExc_ImportError, "Cannot get path of the FreeCAD module!"); - return 0; + return nullptr; } argv[0] = (char*)malloc(PATH_MAX); @@ -185,7 +185,7 @@ PyMOD_INIT_FUNC(FreeCAD) #else # error "Implement: Retrieve the path of the module for your platform." #endif - argv[argc] = 0; + argv[argc] = nullptr; try { // Inits the Application