summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextcursor.cpp
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-03-30 14:56:41 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-03-30 14:56:41 (GMT)
commit87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3 (patch)
treef8b8c24056d54e19937dea1b0301af558597726a /src/gui/text/qtextcursor.cpp
parent09ce407aaa4a00013a606bf0011faf6cbc654c72 (diff)
parent00f7426f3906361fb5addb36e428648eee5e2983 (diff)
downloadQt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.zip
Qt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.tar.gz
Qt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Conflicts: doc/src/modules.qdoc mkspecs/common/symbian/symbian.conf src/gui/graphicsview/qgraphicswidget.h src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def
Diffstat (limited to 'src/gui/text/qtextcursor.cpp')
-rw-r--r--src/gui/text/qtextcursor.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index c81d538..c91df3c 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1145,7 +1145,7 @@ void QTextCursor::setPosition(int pos, MoveMode m)
Returns the absolute position of the cursor within the document.
The cursor is positioned between characters.
- \sa setPosition() movePosition() anchor()
+ \sa setPosition() movePosition() anchor() positionInBlock()
*/
int QTextCursor::position() const
{
@@ -1155,6 +1155,22 @@ int QTextCursor::position() const
}
/*!
+ \since 4.7
+ Returns the relative position of the cursor within the block.
+ The cursor is positioned between characters.
+
+ This is equivalent to \c{ position() - block().position()}.
+
+ \sa position()
+*/
+int QTextCursor::positionInBlock() const
+{
+ if (!d || !d->priv)
+ return 0;
+ return d->position - d->block().position();
+}
+
+/*!
Returns the anchor position; this is the same as position() unless
there is a selection in which case position() marks one end of the
selection and anchor() marks the other end. Just like the cursor
@@ -2414,9 +2430,17 @@ int QTextCursor::blockNumber() const
return d->block().blockNumber();
}
+
/*!
\since 4.2
Returns the position of the cursor within its containing line.
+
+ Note that this is the column number relative to a wrapped line,
+ not relative to the block (i.e. the paragraph).
+
+ You probably want to call positionInBlock() instead.
+
+ \sa positionInBlock()
*/
int QTextCursor::columnNumber() const
{