uic: Introduce nullptr

Apply Fixits by Qt Creator.

Change-Id: Ic2d65b2604d1d71d910773e02bcdf2466f49e52c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Friedemann Kleint 2019-06-06 10:52:22 +02:00
parent 38f1a36f60
commit 2f84ec4bcd
5 changed files with 10 additions and 11 deletions

View File

@ -706,7 +706,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
addWizardPage(varName, node, parentWidget);
} else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QToolBox"))) {
const DomProperty *plabel = attributes.value(QLatin1String("label"));
DomString *plabelString = plabel ? plabel->elementString() : 0;
DomString *plabelString = plabel ? plabel->elementString() : nullptr;
QString icon;
if (const DomProperty *picon = attributes.value(QLatin1String("icon")))
icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition
@ -729,7 +729,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
}
} else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QTabWidget"))) {
const DomProperty *ptitle = attributes.value(QLatin1String("title"));
DomString *ptitleString = ptitle ? ptitle->elementString() : 0;
DomString *ptitleString = ptitle ? ptitle->elementString() : nullptr;
QString icon;
if (const DomProperty *picon = attributes.value(QLatin1String("icon")))
icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition
@ -844,7 +844,7 @@ void WriteInitialization::addButtonGroup(const DomWidget *buttonNode, const QStr
const DomButtonGroup *group = m_driver->findButtonGroup(attributeName);
// Legacy feature: Create missing groups on the fly as the UIC button group feature
// was present before the actual Designer support (4.5)
const bool createGroupOnTheFly = group == 0;
const bool createGroupOnTheFly = group == nullptr;
if (createGroupOnTheFly) {
DomButtonGroup *newGroup = new DomButtonGroup;
newGroup->setAttributeName(attributeName);
@ -2619,7 +2619,6 @@ static void generateMultiDirectiveEnd(QTextStream &outputStream, const QSet<QStr
WriteInitialization::Item::Item(const QString &itemClassName, const QString &indent, QTextStream &setupUiStream, QTextStream &retranslateUiStream, Driver *driver)
:
m_parent(0),
m_itemClassName(itemClassName),
m_indent(indent),
m_setupUiStream(setupUiStream),

View File

@ -188,7 +188,7 @@ private:
ItemData m_setupUiData;
ItemData m_retranslateUiData;
QList<Item *> m_children;
Item *m_parent;
Item *m_parent = nullptr;
const QString m_itemClassName;
const QString m_indent;

View File

@ -256,7 +256,7 @@ bool Driver::uic(const QString &fileName, DomUI *ui, QTextStream *out)
QTextStream *oldOutput = m_output;
m_output = out != 0 ? out : &m_stdout;
m_output = out != nullptr ? out : &m_stdout;
Uic tool(this);
const bool result = tool.write(ui);

View File

@ -137,7 +137,7 @@ int runUic(int argc, char *argv[])
return !driver.printDependencies(inputFile);
}
QTextStream *out = 0;
QTextStream *out = nullptr;
QFile f;
if (!driver.option().outputFile.isEmpty()) {
f.setFileName(driver.option().outputFile);

View File

@ -69,7 +69,7 @@ bool Uic::printDependencies()
return false;
}
DomUI *ui = 0;
DomUI *ui = nullptr;
{
QXmlStreamReader reader;
reader.setDevice(&f);
@ -178,7 +178,7 @@ static double versionFromUiAttribute(QXmlStreamReader &reader)
DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
{
DomUI *ui = 0;
DomUI *ui = nullptr;
const QString uiElement = QLatin1String("ui");
while (!reader.atEnd()) {
@ -189,7 +189,7 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
if (version < 4.0) {
const QString msg = QString::fromLatin1("uic: File generated with too old version of Qt Designer (%1)").arg(version);
fprintf(stderr, "%s\n", qPrintable(msg));
return 0;
return nullptr;
}
ui = new DomUI();
@ -201,7 +201,7 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
}
if (reader.hasError()) {
delete ui;
ui = 0;
ui = nullptr;
fprintf(stderr, "%s\n", qPrintable(QString::fromLatin1("uic: Error in line %1, column %2 : %3")
.arg(reader.lineNumber()).arg(reader.columnNumber())
.arg(reader.errorString())));