Some clang-tidy -use-modernize-nullptr

Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
hjk
2019-07-31 17:21:41 +02:00
parent 630385751a
commit 2e14df7561
180 changed files with 1312 additions and 1312 deletions

View File

@@ -36,7 +36,7 @@ namespace Internal {
class EditorData
{
public:
explicit operator bool() const { return formWindowEditor != 0; }
explicit operator bool() const { return formWindowEditor != nullptr; }
FormWindowEditor *formWindowEditor = nullptr;
SharedTools::WidgetHost *widgetHost = nullptr;

View File

@@ -65,7 +65,7 @@ FormEditorStack::~FormEditorStack()
void FormEditorStack::add(const EditorData &data)
{
if (m_designerCore == 0) { // Initialize first time here
if (m_designerCore == nullptr) { // Initialize first time here
m_designerCore = data.widgetHost->formWindow()->core();
connect(m_designerCore->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
this, &FormEditorStack::updateFormWindowSelectionHandles);
@@ -128,7 +128,7 @@ EditorData FormEditorStack::activeEditor() const
SharedTools::WidgetHost *FormEditorStack::formWindowEditorForFormWindow(const QDesignerFormWindowInterface *fw) const
{
const int i = indexOfFormWindow(fw);
return i != -1 ? m_formEditors[i].widgetHost : static_cast<SharedTools::WidgetHost *>(0);
return i != -1 ? m_formEditors[i].widgetHost : static_cast<SharedTools::WidgetHost *>(nullptr);
}
void FormEditorStack::removeFormWindowEditor(QObject *xmlEditor)
@@ -183,7 +183,7 @@ void FormEditorStack::formSizeChanged(int w, int h)
SharedTools::WidgetHost *FormEditorStack::formWindowEditorForXmlEditor(const Core::IEditor *xmlEditor) const
{
const int i = indexOfFormEditor(xmlEditor);
return i != -1 ? m_formEditors.at(i).widgetHost : static_cast<SharedTools::WidgetHost *>(0);
return i != -1 ? m_formEditors.at(i).widgetHost : static_cast<SharedTools::WidgetHost *>(nullptr);
}
void FormEditorStack::modeAboutToChange(Core::Id mode)

View File

@@ -229,7 +229,7 @@ static FormEditorData *d = nullptr;
static FormEditorW *m_instance = nullptr;
FormEditorData::FormEditorData() :
m_formeditor(QDesignerComponents::createFormEditor(0)),
m_formeditor(QDesignerComponents::createFormEditor(nullptr)),
m_initStage(FormEditorW::RegisterPlugins)
{
if (Designer::Constants::Internal::debug)
@@ -238,7 +238,7 @@ FormEditorData::FormEditorData() :
d = this;
std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount,
static_cast<QWidget *>(0));
static_cast<QWidget *>(nullptr));
m_formeditor->setTopLevel(ICore::mainWindow());
m_formeditor->setSettingsManager(new SettingsManager());
@@ -352,7 +352,7 @@ void FormEditorData::setupViewActions()
void FormEditorData::fullInit()
{
QTC_ASSERT(m_initStage == FormEditorW::RegisterPlugins, return);
QElapsedTimer *initTime = 0;
QElapsedTimer *initTime = nullptr;
if (Designer::Constants::Internal::debug) {
initTime = new QElapsedTimer;
initTime->start();
@@ -437,32 +437,32 @@ void FormEditorData::fullInit()
void FormEditorData::initDesignerSubWindows()
{
std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(0));
std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(nullptr));
QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, 0);
QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, nullptr);
wb->setWindowTitle(tr("Widget Box"));
wb->setObjectName("WidgetBox");
m_formeditor->setWidgetBox(wb);
m_designerSubWindows[WidgetBoxSubWindow] = wb;
QDesignerObjectInspectorInterface *oi = QDesignerComponents::createObjectInspector(m_formeditor, 0);
QDesignerObjectInspectorInterface *oi = QDesignerComponents::createObjectInspector(m_formeditor, nullptr);
oi->setWindowTitle(tr("Object Inspector"));
oi->setObjectName("ObjectInspector");
m_formeditor->setObjectInspector(oi);
m_designerSubWindows[ObjectInspectorSubWindow] = oi;
QDesignerPropertyEditorInterface *pe = QDesignerComponents::createPropertyEditor(m_formeditor, 0);
QDesignerPropertyEditorInterface *pe = QDesignerComponents::createPropertyEditor(m_formeditor, nullptr);
pe->setWindowTitle(tr("Property Editor"));
pe->setObjectName("PropertyEditor");
m_formeditor->setPropertyEditor(pe);
m_designerSubWindows[PropertyEditorSubWindow] = pe;
QWidget *se = QDesignerComponents::createSignalSlotEditor(m_formeditor, 0);
QWidget *se = QDesignerComponents::createSignalSlotEditor(m_formeditor, nullptr);
se->setWindowTitle(tr("Signals && Slots Editor"));
se->setObjectName("SignalsAndSlotsEditor");
m_designerSubWindows[SignalSlotEditorSubWindow] = se;
QDesignerActionEditorInterface *ae = QDesignerComponents::createActionEditor(m_formeditor, 0);
QDesignerActionEditorInterface *ae = QDesignerComponents::createActionEditor(m_formeditor, nullptr);
ae->setWindowTitle(tr("Action Editor"));
ae->setObjectName("ActionEditor");
m_formeditor->setActionEditor(ae);
@@ -641,7 +641,7 @@ void FormEditorData::setupActions()
QObject::connect(m_fwm, &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
[this] (QDesignerFormWindowInterface *afw) {
m_fwm->closeAllPreviews();
setPreviewMenuEnabled(afw != 0);
setPreviewMenuEnabled(afw != nullptr);
});
}
@@ -770,11 +770,11 @@ IEditor *FormEditorData::createEditor()
qDebug() << "FormEditorW::createEditor";
// Create and associate form and text editor.
m_fwm->closeAllPreviews();
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(0);
QTC_ASSERT(form, return 0);
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
QTC_ASSERT(form, return nullptr);
QObject::connect(form, &QDesignerFormWindowInterface::toolChanged, [this] (int i) { toolChanged(i); });
SharedTools::WidgetHost *widgetHost = new SharedTools::WidgetHost( /* parent */ 0, form);
SharedTools::WidgetHost *widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
FormWindowEditor *formWindowEditor = m_xmlEditorFactory->create(form);
m_editorWidget->add(widgetHost, formWindowEditor);
@@ -806,7 +806,7 @@ SharedTools::WidgetHost *FormEditorW::activeWidgetHost()
ensureInitStage(FullyInitialized);
if (d->m_editorWidget)
return d->m_editorWidget->activeEditor().widgetHost;
return 0;
return nullptr;
}
FormWindowEditor *FormEditorW::activeEditor()
@@ -814,7 +814,7 @@ FormWindowEditor *FormEditorW::activeEditor()
ensureInitStage(FullyInitialized);
if (d->m_editorWidget)
return d->m_editorWidget->activeEditor().formWindowEditor;
return 0;
return nullptr;
}
void FormEditorData::updateShortcut(Command *command)

View File

@@ -58,7 +58,7 @@ Utils::WizardPage *FormPageFactory::create(ProjectExplorer::JsonWizard *wizard,
Q_UNUSED(wizard)
Q_UNUSED(data)
QTC_ASSERT(canCreate(typeId), return 0);
QTC_ASSERT(canCreate(typeId), return nullptr);
FormTemplateWizardPage *page = new FormTemplateWizardPage;
return page;

View File

@@ -50,7 +50,7 @@ FormWindowEditor::~FormWindowEditor()
QWidget *FormWindowEditor::toolBar()
{
return 0;
return nullptr;
}
QString FormWindowEditor::contents() const

View File

@@ -286,7 +286,7 @@ void FormWindowFile::slotFormWindowRemoved(QDesignerFormWindowInterface *w)
// as calls to isDirty() are triggered at arbitrary times
// while building.
if (w == m_formWindow)
m_formWindow = 0;
m_formWindow = nullptr;
}
} // namespace Internal

View File

@@ -114,7 +114,7 @@ QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
{
if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost())
return host->integrationContainer();
return 0;
return nullptr;
}
static QList<Document::Ptr> findDocumentsIncluding(const Snapshot &docTable,
@@ -212,7 +212,7 @@ static const Class *findClass(const Namespace *parentNameSpace, const LookupCont
} // member is namespave
} // member is no class
} // for members
return 0;
return nullptr;
}
static Function *findDeclaration(const Class *cl, const QString &functionName)
@@ -242,7 +242,7 @@ static Function *findDeclaration(const Class *cl, const QString &functionName)
return fun;
}
}
return 0;
return nullptr;
}
// TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this function
@@ -555,7 +555,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
// Find the class definition (ui class defined as member or base class)
// in the file itself or in the directly included files (order 1).
QString namespaceName;
const Class *cl = 0;
const Class *cl = nullptr;
Document::Ptr doc;
for (const Document::Ptr &d : qAsConst(docMap)) {

View File

@@ -48,7 +48,7 @@ QWidget *SettingsPage::widget()
{
m_initialized = true;
if (!m_widget)
m_widget = m_designerPage->createPage(0);
m_widget = m_designerPage->createPage(nullptr);
return m_widget;
}