summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-10-26 17:31:18 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-01-22 03:36:16 +0000
commitd921a9bd157b04242722ab4326c5f2ea8e88cbea (patch)
tree9e9583e6aefa16a80a1390d755a11b347f5da3ab /src/gui/text/qtextdocument.cpp
parenta44e4a6cfe37482b3b4b1527eabc807c585d0500 (diff)
Hide better the private API QTextCursor constructors
Both constructors were taking a pointer, so they participated in overload resolution along with QTextDocument and QTextFrame pointers. Instead, make them take references and move them to the private section of QTextCursor. That necessitated adding a method to QTextCursorPrivate to access that private constructor from non-friend classes. Change-Id: I7e6338336dd6468ead24ffff1410e3bc534d77dd Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/text/qtextdocument.cpp')
-rw-r--r--src/gui/text/qtextdocument.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 0affd3239d..3edf652f35 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -33,6 +33,7 @@
#include "qtextdocument.h"
#include <qtextformat.h>
+#include "qtextcursor_p.h"
#include "qtextdocumentlayout_p.h"
#include "qtextdocumentfragment.h"
#include "qtextdocumentfragment_p.h"
@@ -1273,7 +1274,7 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + expression.length(), QTextCursor::KeepAnchor);
return true;
}
@@ -1391,7 +1392,7 @@ static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + expr.matchedLength(), QTextCursor::KeepAnchor);
return true;
}
@@ -1519,7 +1520,7 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + match.capturedLength(), QTextCursor::KeepAnchor);
return true;
}