First version of QML navigation.

This commit is contained in:
Erik Verbruggen
2009-09-11 14:42:50 +02:00
parent e58ff77bd3
commit 71549ec6a2
14 changed files with 608 additions and 7 deletions

View File

@@ -3242,6 +3242,10 @@ void BaseTextEditor::indentBlock(QTextDocument *, QTextBlock, QChar)
{
}
void BaseTextEditor::reformatBlock(QTextDocument *, QTextBlock)
{
}
void BaseTextEditor::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar)
{
if (cursor.hasSelection()) {
@@ -3256,6 +3260,20 @@ void BaseTextEditor::indent(QTextDocument *doc, const QTextCursor &cursor, QChar
}
}
void BaseTextEditor::reformat(QTextDocument *doc, const QTextCursor &cursor)
{
if (cursor.hasSelection()) {
QTextBlock block = doc->findBlock(qMin(cursor.selectionStart(), cursor.selectionEnd()));
const QTextBlock end = doc->findBlock(qMax(cursor.selectionStart(), cursor.selectionEnd())).next();
do {
reformatBlock(doc, block);
block = block.next();
} while (block.isValid() && block != end);
} else {
reformatBlock(doc, cursor.block());
}
}
BaseTextEditor::Link BaseTextEditor::findLinkAt(const QTextCursor &, bool)
{
return Link();
@@ -3987,6 +4005,14 @@ void BaseTextEditor::format()
cursor.endEditBlock();
}
void BaseTextEditor::reformat()
{
QTextCursor cursor = textCursor();
cursor.beginEditBlock();
reformat(document(), cursor);
cursor.endEditBlock();
}
void BaseTextEditor::rewrapParagraph()
{
const int paragraphWidth = displaySettings().m_wrapColumn;