QmlDesigner: Allow to disable semantic checks in transaction

The semantic checks are slow and sometimes we knoe that they
are not required.

Change-Id: I43cae131e4c5f47d2a61d34975913dd8cb6370fc
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-06-21 16:09:59 +02:00
parent e31a389b0f
commit 9410a812b9
2 changed files with 14 additions and 0 deletions

View File

@@ -72,12 +72,23 @@ bool RewriterTransaction::isValid() const
return m_valid;
}
void RewriterTransaction::ignoreSemanticChecks()
{
m_ignoreSemanticChecks = true;
}
void RewriterTransaction::commit()
{
if (m_valid) {
m_valid = false;
bool oldSemanticChecks = view()->rewriterView()->checkSemanticErrors();
if (m_ignoreSemanticChecks)
view()->rewriterView()->setCheckSemanticErrors(false);
view()->emitRewriterEndTransaction();
view()->rewriterView()->setCheckSemanticErrors(oldSemanticChecks);
if (m_activeIdentifier) {
qDebug() << "Commit RewriterTransaction:" << m_identifier << m_identifierNumber;
bool success = m_identifierList.removeOne(m_identifier + QByteArrayLiteral("-") + QByteArray::number(m_identifierNumber));

View File

@@ -46,6 +46,8 @@ public:
bool isValid() const;
void ignoreSemanticChecks();
protected:
AbstractView *view();
private:
@@ -55,6 +57,7 @@ private:
int m_identifierNumber;
static QList<QByteArray> m_identifierList;
static bool m_activeIdentifier;
bool m_ignoreSemanticChecks = false;
};
} //QmlDesigner