diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-22 01:05:17 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-22 01:05:17 (GMT) |
commit | 0109df3ee449767c1836ec7028ac219c57cf9ca7 (patch) | |
tree | 5fdc90fd34ac4e49ba05bef47a86427e4df71917 /src/gui/text/qtextcursor.cpp | |
parent | 46e84339a9eaf1587528c20a4c9e05bc1b549afd (diff) | |
parent | 0a83a6c571fadb454cb8711aed84258b061d44b5 (diff) | |
download | Qt-0109df3ee449767c1836ec7028ac219c57cf9ca7.zip Qt-0109df3ee449767c1836ec7028ac219c57cf9ca7.tar.gz Qt-0109df3ee449767c1836ec7028ac219c57cf9ca7.tar.bz2 |
Merge remote branch 'origin/master' into bearermanagement/unit-tests
Conflicts:
src/network/access/qnetworkaccessmanager.cpp
Diffstat (limited to 'src/gui/text/qtextcursor.cpp')
-rw-r--r-- | src/gui/text/qtextcursor.cpp | 26 |
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 { |