forked from qt-creator/qt-creator
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:
@@ -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));
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user