diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 9a8a4d56cc3..4bba46057d3 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -55,13 +55,12 @@ class BranchNode { public: BranchNode() : - parent(0), name("") { } BranchNode(const QString &n, const QString &s = QString(), const QString &t = QString(), const QDateTime &dt = QDateTime()) : - parent(0), name(n), sha(s), tracking(t), dateTime(dt) + name(n), sha(s), tracking(t), dateTime(dt) { } ~BranchNode() @@ -120,7 +119,7 @@ public: if (children.at(i)->name == name) return children.at(i); } - return 0; + return nullptr; } QStringList fullName(bool includePrefix = false) const @@ -182,7 +181,7 @@ public: return children.indexOf(node); } - BranchNode *parent; + BranchNode *parent = nullptr; QList children; QString name; @@ -349,7 +348,7 @@ void BranchModel::clear() if (hasTags()) m_rootNode->children.takeLast(); - m_currentBranch = 0; + m_currentBranch = nullptr; m_obsoleteLocalBranches.clear(); } @@ -376,7 +375,7 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage if (m_currentBranch) { if (m_currentBranch->parent == m_rootNode->children.at(LocalBranches)) - m_currentBranch = 0; + m_currentBranch = nullptr; setCurrentBranch(); } @@ -448,8 +447,7 @@ QString BranchModel::fullName(const QModelIndex &idx, bool includePrefix) const BranchNode *node = indexToNode(idx); if (!node || !node->isLeaf()) return QString(); - QStringList path = node->fullName(includePrefix); - return path.join('/'); + return node->fullName(includePrefix).join('/'); } QStringList BranchModel::localBranchNames() const @@ -623,7 +621,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel if (slash != -1) { const QString nodeName = name.left(slash); int pos = positionForName(local, nodeName); - BranchNode *child = (pos == local->count()) ? 0 : local->children.at(pos); + BranchNode *child = (pos == local->count()) ? nullptr : local->children.at(pos); if (!child || child->name != nodeName) { child = new BranchNode(nodeName); beginInsertRows(nodeToIndex(local, 0), pos, pos); @@ -697,7 +695,7 @@ void BranchModel::parseOutputLine(const QString &line) QStringList nameParts = fullName.split('/'); nameParts.removeFirst(); // remove refs... - BranchNode *root = 0; + BranchNode *root = nullptr; if (nameParts.first() == "heads") { root = m_rootNode->children.at(LocalBranches); } else if (nameParts.first() == "remotes") { @@ -731,7 +729,7 @@ void BranchModel::parseOutputLine(const QString &line) BranchNode *BranchModel::indexToNode(const QModelIndex &index) const { if (index.column() > 1) - return 0; + return nullptr; if (!index.isValid()) return m_rootNode; return static_cast(index.internalPointer());