Commit 5fd660c1 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents b38ba4d8 c96d63f0
......@@ -35,6 +35,7 @@
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtGui/QPushButton>
#include <QtGui/QTreeWidget>
#include <QtGui/QHeaderView>
......
......@@ -58,6 +58,7 @@ void CppHighlighter::highlightBlock(const QString &text)
braceDepth = previousState >> 8;
}
SimpleLexer tokenize;
tokenize.setQtMocRunEnabled(false);
......@@ -210,6 +211,28 @@ void CppHighlighter::highlightBlock(const QString &text)
TextEditDocumentLayout::setParentheses(currentBlock(), parentheses);
// optimization: if only the brace depth changes, we adjust subsequent blocks
// to have QSyntaxHighlighter stop the rehighlighting
int currentState = currentBlockState();
if (currentState != -1) {
int oldState = currentState & 0xff;
int oldBraceDepth = currentState >> 8;
if (oldState == tokenize.state() && oldBraceDepth != braceDepth) {
int delta = braceDepth - oldBraceDepth;
QTextBlock block = currentBlock().next();
while (block.isValid()) {
currentState = block.userState();
if (currentState != -1) {
oldState = currentState & 0xff;
oldBraceDepth = currentState >> 8;
block.setUserState(qMax(0, (oldBraceDepth + delta) << 8 ) | oldState);
}
block = block.next();
}
}
}
setCurrentBlockState((braceDepth << 8) | tokenize.state());
}
......
......@@ -131,8 +131,6 @@ ProjectWindow::~ProjectWindow()
void ProjectWindow::restoreStatus()
{
m_panelsTabWidget->setFocus();
if (!m_treeWidget->currentItem() && m_treeWidget->topLevelItemCount()) {
m_treeWidget->setCurrentItem(m_treeWidget->topLevelItem(0), 0, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment