diff --git a/src/canvas.cpp b/src/canvas.cpp
--- a/src/canvas.cpp
+++ b/src/canvas.cpp
@@ -124,7 +124,7 @@
void Canvas::drawLine(double x1, double y1, double x2, double y2)
{
if (penWidthIsZero) return;
- QGraphicsLineItem* line = new QGraphicsLineItem(QLineF(x1, y1, x2, y2), 0);
+ QGraphicsLineItem* line = new QGraphicsLineItem(QLineF(x1, y1, x2, y2), nullptr);
_scene->addItem(line);
line->setPen(*pen);
lines.append(line);
diff --git a/src/editor.cpp b/src/editor.cpp
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -243,7 +243,7 @@
delete savefile;
if (!url.isLocalFile())
{
- KIO::StoredTransferJob *job = KIO::storedPut(savefile, url, -1, 0);
+ KIO::StoredTransferJob *job = KIO::storedPut(savefile, url, -1, nullptr);
if(job->exec()){
setCurrentUrl(url);
editor->document()->setModified(false);
@@ -300,7 +300,7 @@
}
if (fdialog->exec() == QDialog::Accepted && !fdialog->pattern().isEmpty()) {
long kOpts = fdialog->options();
- QTextDocument::FindFlags qOpts = 0;
+ QTextDocument::FindFlags qOpts = nullptr;
if (kOpts & KFind::CaseSensitive) { qOpts |= QTextDocument::FindCaseSensitively; }
if (kOpts & KFind::FindBackwards) { qOpts |= QTextDocument::FindBackward; }
if (kOpts & KFind::WholeWordsOnly) { qOpts |= QTextDocument::FindWholeWords; }
@@ -312,7 +312,7 @@
{
if (!fdialog->pattern().isEmpty()) {
long kOpts = fdialog->options();
- QTextDocument::FindFlags qOpts = 0;
+ QTextDocument::FindFlags qOpts = nullptr;
if (kOpts & KFind::CaseSensitive) { qOpts |= QTextDocument::FindCaseSensitively; }
if (kOpts & KFind::FindBackwards) { qOpts |= QTextDocument::FindBackward; }
if (kOpts & KFind::WholeWordsOnly) { qOpts |= QTextDocument::FindWholeWords; }
@@ -324,7 +324,7 @@
{
if(!fdialog->pattern().isEmpty()) {
long kOpts = fdialog->options();
- QTextDocument::FindFlags qOpts = 0;
+ QTextDocument::FindFlags qOpts = nullptr;
if (kOpts & KFind::CaseSensitive) { qOpts |= QTextDocument::FindCaseSensitively; }
// search in the opposite direction as findNext()
if (!(kOpts & KFind::FindBackwards)) { qOpts |= QTextDocument::FindBackward; }
@@ -386,7 +386,7 @@
token = tokenizer->getToken();
}
delete token;
- return 0;
+ return nullptr;
}
@@ -424,7 +424,7 @@
default: escaped = token->look().toHtmlEscaped(); break;
}
format = highlighter->tokenToFormat(token);
- if (format != 0) {
+ if (format) {
bool bold = format->fontWeight() > 50;
html += QString("%3")
.arg(format->foreground().color().name())
diff --git a/src/errordialog.cpp b/src/errordialog.cpp
--- a/src/errordialog.cpp
+++ b/src/errordialog.cpp
@@ -35,7 +35,7 @@
ErrorDialog::ErrorDialog(QWidget* parent)
: QDialog(parent)
{
- errorList = 0;
+ errorList = nullptr;
setWindowTitle(i18n("Errors"));
setModal(false);
@@ -94,7 +94,7 @@
void ErrorDialog::clear()
{
disable();
- errorList = 0;
+ errorList = nullptr;
errorTable->clearContents();
// put a friendly 'nothing to see here' notice in the empty table
@@ -113,7 +113,7 @@
void ErrorDialog::enable()
{
- Q_ASSERT (errorList != 0);
+ Q_ASSERT (errorList);
errorTable->setEnabled(true);
m_buttonBox->button(QDialogButtonBox::Help)->setEnabled(true);
connect(errorTable, &QTableWidget::itemSelectionChanged, this, &ErrorDialog::selectedErrorChangedProxy);
@@ -151,7 +151,7 @@
void ErrorDialog::selectedErrorChangedProxy()
{
- Q_ASSERT (errorList != 0);
+ Q_ASSERT (errorList);
const Token* t = &errorList->at(errorTable->selectedItems().first()->row()).token();
emit currentlySelectedError(t->startRow(), t->startCol(), t->endRow(), t->endCol());
// //qDebug() << "EMITTED: " << t->startRow() << ", " << t->startCol() << ", " << t->endRow() << ", " << t->endCol();
diff --git a/src/highlighter.cpp b/src/highlighter.cpp
--- a/src/highlighter.cpp
+++ b/src/highlighter.cpp
@@ -82,7 +82,7 @@
QTextCharFormat* format;
while (token->type() != Token::EndOfInput) {
format = tokenToFormat(token);
- if (format != 0) {
+ if (format) {
if (cursorIndex == -1) // does not return, but keeps running
setFormat(token->startCol() - 1, token->endCol() - token->startCol(), *format);
else if (cursorIndex >= token->startCol() && cursorIndex <= token->endCol())
@@ -92,7 +92,7 @@
token = tokenizer->getToken();
}
delete token;
- return 0;
+ return nullptr;
}
QTextCharFormat* Highlighter::tokenToFormat(Token* token)
@@ -113,9 +113,9 @@
case Token::AssignmentCategory: return &assignmentFormat;
// do nothing with these...
- case Token::ParenthesisCategory: return 0;
- case Token::FunctionCallCategory: return 0;
- case Token::ArgumentSeparatorCategory: return 0;
+ case Token::ParenthesisCategory: return nullptr;
+ case Token::FunctionCallCategory: return nullptr;
+ case Token::ArgumentSeparatorCategory: return nullptr;
}
- return 0;
+ return nullptr;
}
diff --git a/src/inspector.cpp b/src/inspector.cpp
--- a/src/inspector.cpp
+++ b/src/inspector.cpp
@@ -71,7 +71,7 @@
// functionMap = new QHash();
// treeMap = new QHash();
- currentlyMarkedTreeItem = 0;
+ currentlyMarkedTreeItem = nullptr;
disable();
@@ -252,7 +252,7 @@
QTreeWidgetItem* result = new QTreeWidgetItem();
result->setText(0, node->token()->look());
QTextCharFormat* format = highlighter->tokenToFormat(node->token());
- if (format != 0) {
+ if (format) {
result->setForeground(0, format->foreground());
QFont font(QFontDatabase::systemFont(QFontDatabase::FixedFont));
font.setBold(format->font().bold());
@@ -270,7 +270,7 @@
int Inspector::findVariable(const QString& name)
{
QTableWidgetItem* item = variableMap[name];
- if (item == 0) return -1;
+ if (!item) return -1;
return item->row();
// old implementation before we had a variableMap
@@ -308,9 +308,9 @@
void Inspector::clearTreeMark()
{
- if (currentlyMarkedTreeItem == 0) return;
+ if (!currentlyMarkedTreeItem) return;
currentlyMarkedTreeItem->setBackground(0, previousTreeBackground);
- currentlyMarkedTreeItem = 0;
+ currentlyMarkedTreeItem = nullptr;
}
void Inspector::clearAllMarks()
diff --git a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -106,7 +106,7 @@
///////////////// run in DBUS mode /////////////////
Translator::instance()->setLanguage();
- new Interpreter(0, true);
+ new Interpreter(nullptr, true);
return app.exec();
@@ -202,7 +202,7 @@
// free some memory
// init the interpreter
- Interpreter* interpreter = new Interpreter(0, true); // set testing to true
+ Interpreter* interpreter = new Interpreter(nullptr, true); // set testing to true
interpreter->initialize(localizedScript);
// install the echoer
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -71,7 +71,7 @@
connect(errorDialog, &ErrorDialog::currentlySelectedError, editor, &Editor::markCurrentError);
- colorPicker = 0;
+ colorPicker = nullptr;
statusBar()->showMessage(i18nc("@info:status the application is ready for commands", "Ready"));
updateContentName(); // also sets the window caption to 'untitled'
@@ -136,7 +136,7 @@
}
void MainWindow::showColorPicker()
{
- if (colorPicker == 0) {
+ if (!colorPicker) {
colorPicker = new ColorPicker(this);
connect(colorPicker, &ColorPicker::pasteText, editor, &Editor::insertPlainText);
}
@@ -762,11 +762,11 @@
Token* cursorToken = editor->currentToken();
QString desc;
- if (cursorToken != 0) {
+ if (cursorToken) {
QString look = cursorToken->look();
int cat = cursorToken->category();
delete cursorToken;
- cursorToken = 0;
+ cursorToken = nullptr;
KLocalizedString layout = ki18n("\"%1\" <%2>");
switch (cat) {
// not showing the look (only the name):