void Editor::uncommentSelection() { int paragraphStart; int paragraphEnd; int indexStart; int indexEnd; getSelection(¶graphStart, &indexStart, ¶graphEnd, &indexEnd); if (paragraphStart < 0) { getCursorPosition(¶graphStart, &indexStart); paragraphEnd = paragraphStart; } if (paragraphStart >= 0 && paragraphEnd >= 0) { for (int i=paragraphStart; i<=paragraphEnd; ++i) { QString str = text(i); int whitespace = 0; while (str.startsWith("/") || (str.length() > 0 && str.at(0).isSpace())) { if (str.length() > 0 && str.at(0).isSpace()) ++whitespace; str.remove(0, 1); } if (whitespace > 0) str.prepend(QString().fill(QChar(' '), whitespace)); insertParagraph(str, i); removeParagraph(i + 1); } repaintChanged(); setModified(TRUE); } }
void QMultiLineEdit::insertLine( const QString &txt, int line ) { insertParagraph( txt, line ); }