summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexttable.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/qtexttable.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/qtexttable.cpp')
-rw-r--r--src/gui/text/qtexttable.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 454d3440d6..553dc3c772 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -35,6 +35,7 @@
#include "qtextcursor.h"
#include "qtextformat.h"
#include <qdebug.h>
+#include "qtextcursor_p.h"
#include "qtexttable_p.h"
#include "qvarlengtharray.h"
@@ -220,7 +221,7 @@ int QTextTableCell::columnSpan() const
*/
QTextCursor QTextTableCell::firstCursorPosition() const
{
- return QTextCursor(table->d_func()->pieceTable, firstPosition());
+ return QTextCursorPrivate::fromPosition(table->d_func()->pieceTable, firstPosition());
}
/*!
@@ -230,7 +231,7 @@ QTextCursor QTextTableCell::firstCursorPosition() const
*/
QTextCursor QTextTableCell::lastCursorPosition() const
{
- return QTextCursor(table->d_func()->pieceTable, lastPosition());
+ return QTextCursorPrivate::fromPosition(table->d_func()->pieceTable, lastPosition());
}
@@ -1103,10 +1104,10 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
if (nextPos > pos) {
if (needsParagraph) {
needsParagraph = false;
- QTextCursor(p, insertPos++).insertBlock();
+ QTextCursorPrivate::fromPosition(p, insertPos++).insertBlock();
p->move(pos + 1, insertPos, nextPos - pos);
} else if (rowHasText) {
- QTextCursor(p, insertPos++).insertText(QLatin1String(" "));
+ QTextCursorPrivate::fromPosition(p, insertPos++).insertText(QLatin1String(" "));
p->move(pos + 1, insertPos, nextPos - pos);
} else {
p->move(pos, insertPos, nextPos - pos);
@@ -1282,7 +1283,7 @@ QTextCursor QTextTable::rowStart(const QTextCursor &c) const
int row = cell.row();
QTextDocumentPrivate *p = d->pieceTable;
QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), d->grid[row*d->nCols]);
- return QTextCursor(p, it.position());
+ return QTextCursorPrivate::fromPosition(p, it.position());
}
/*!
@@ -1304,7 +1305,7 @@ QTextCursor QTextTable::rowEnd(const QTextCursor &c) const
int fragment = row < d->nRows ? d->grid[row*d->nCols] : d->fragment_end;
QTextDocumentPrivate *p = d->pieceTable;
QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), fragment);
- return QTextCursor(p, it.position() - 1);
+ return QTextCursorPrivate::fromPosition(p, it.position() - 1);
}
/*!