summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextcursor.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-22 14:46:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-06 12:13:20 +0100
commitece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch)
treefa4a0fdbda040d24f1a2d07a320635c76980f431 /src/gui/text/qtextcursor.cpp
parentb19220d17fa66de5ded41690ffff263ee2af5c63 (diff)
Tidy nullptr usage
Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qtextcursor.cpp')
-rw-r--r--src/gui/text/qtextcursor.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index c88497840f..b69b94d4e7 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -371,7 +371,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
int newPosition = position;
- if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != 0) {
+ if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != nullptr) {
if ((op >= QTextCursor::EndOfLine && op <= QTextCursor::NextWord)
|| (op >= QTextCursor::Right && op <= QTextCursor::WordRight)) {
QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
@@ -671,7 +671,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
QTextTable *QTextCursorPrivate::complexSelectionTable() const
{
if (position == anchor)
- return 0;
+ return nullptr;
QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
if (t) {
@@ -681,7 +681,7 @@ QTextTable *QTextCursorPrivate::complexSelectionTable() const
Q_ASSERT(cell_anchor.isValid());
if (cell_pos == cell_anchor)
- t = 0;
+ t = nullptr;
}
return t;
}
@@ -1044,7 +1044,7 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
Constructs a null cursor.
*/
QTextCursor::QTextCursor()
- : d(0)
+ : d(nullptr)
{
}
@@ -1623,7 +1623,7 @@ bool QTextCursor::hasComplexSelection() const
if (!d)
return false;
- return d->complexSelectionTable() != 0;
+ return d->complexSelectionTable() != nullptr;
}
/*!
@@ -2111,7 +2111,7 @@ QTextList *QTextCursor::insertList(QTextListFormat::Style style)
QTextList *QTextCursor::createList(const QTextListFormat &format)
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
QTextList *list = static_cast<QTextList *>(d->priv->createObject(format));
QTextBlockFormat modifier;
@@ -2146,7 +2146,7 @@ QTextList *QTextCursor::createList(QTextListFormat::Style style)
QTextList *QTextCursor::currentList() const
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
QTextBlockFormat b = blockFormat();
QTextObject *o = d->priv->objectForFormat(b);
@@ -2186,7 +2186,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols)
QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat &format)
{
if(!d || !d->priv || rows == 0 || cols == 0)
- return 0;
+ return nullptr;
int pos = d->position;
QTextTable *t = QTextTablePrivate::createTable(d->priv, d->position, rows, cols, format);
@@ -2206,7 +2206,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat
QTextTable *QTextCursor::currentTable() const
{
if(!d || !d->priv)
- return 0;
+ return nullptr;
QTextFrame *frame = d->priv->frameAt(d->position);
while (frame) {
@@ -2215,7 +2215,7 @@ QTextTable *QTextCursor::currentTable() const
return table;
frame = frame->parentFrame();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2230,7 +2230,7 @@ QTextTable *QTextCursor::currentTable() const
QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format)
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
return d->priv->insertFrame(selectionStart(), selectionEnd(), format);
}
@@ -2243,7 +2243,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format)
QTextFrame *QTextCursor::currentFrame() const
{
if(!d || !d->priv)
- return 0;
+ return nullptr;
return d->priv->frameAt(d->position);
}
@@ -2603,7 +2603,7 @@ QTextDocument *QTextCursor::document() const
{
if (d->priv)
return d->priv->document();
- return 0; // document went away
+ return nullptr; // document went away
}
QT_END_NAMESPACE