Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

bool QTextCursor::movePosition ( MoveOperation  operation,
MoveMode  mode = MoveAnchor,
int  n = 1 

Moves the cursor by performing the given operation n times, using the specified mode, and returns true if all operations were completed successfully; otherwise returns false.

For example, if this function is repeatedly used to seek to the end of the next word, it will eventually fail when the end of the document is reached.

By default, the move operation is performed once (n = 1).

If mode is KeepAnchor, the cursor selects the text it moves over. This is the same effect that the user achieves when they hold down the Shift key and move the cursor with the cursor keys.

Definition at line 1032 of file qtextcursor.cpp.

Referenced by QTextDocumentFragment::QTextDocumentFragment(), QSyntaxHighlighter::rehighlight(), and select().

    if (!d || !d->priv)
        return false;
    switch (op) {
        case Start:
        case StartOfLine:
        case End:
        case EndOfLine:
            n = 1;
        default: break;
    for (; n > 0; --n) {
        if (!d->movePosition(op, mode))
            return false;
    return true;

Generated by  Doxygen 1.6.0   Back to index