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

void Q3TextEdit::removeParagraph ( int  para  )  [virtual, slot, inherited]

Removes the paragraph para.

Definition at line 3069 of file q3textedit.cpp.

References Q3TextEdit::removeSelectedText().

Referenced by Q3MultiLineEdit::removeLine().

{
#ifdef QT_TEXTEDIT_OPTIMIZATION
    if (d->optimMode)
        return;
#endif
    Q3TextParagraph *p = doc->paragAt(para);
    if (!p)
        return;

    for (int i = 0; i < doc->numSelections(); ++i)
        doc->removeSelection(i);

    Q3TextCursor start(doc);
    Q3TextCursor end(doc);
    start.setParagraph(p);
    start.setIndex(0);
    end.setParagraph(p);
    end.setIndex(p->length() - 1);

    if (!(p == doc->firstParagraph() && p == doc->lastParagraph())) {
        if (p->next()) {
            end.setParagraph(p->next());
            end.setIndex(0);
        } else if (p->prev()) {
            start.setParagraph(p->prev());
            start.setIndex(p->prev()->length() - 1);
        }
    }

    doc->setSelectionStart(Q3TextDocument::Temp, start);
    doc->setSelectionEnd(Q3TextDocument::Temp, end);
    removeSelectedText(Q3TextDocument::Temp);
}


Generated by  Doxygen 1.6.0   Back to index