void TextModelLavaan::setErrorState(bool error, QString message, int errorBlock, int tokenPos, int tokenLength)
{
	if (error != _inError || message != _errorMessage || errorBlock != _errorBlock || tokenPos != _errorTokenPos || tokenLength != _errorTokenLength)
	{
		_inError = error;
		_errorMessage = message;
		_errorBlock = errorBlock;
		_errorTokenPos = tokenPos;
		_errorTokenLength = tokenLength;

		emit errorStateChanged();
	}
}
/*!
  Sets this state's error state to be the given \a state. If the error state
  is not set, or if it is set to 0, the state will inherit its parent's error
  state recursively. If no error state is set for the state itself or any of
  its ancestors, an error will cause the machine to stop executing and an error
  will be printed to the console.
*/
void QState::setErrorState(QAbstractState *state)
{
    Q_D(QState);
    if (state != 0 && qobject_cast<QStateMachine*>(state)) {
        qWarning("QStateMachine::setErrorState: root state cannot be error state");
        return;
    }
    if (state != 0 && (!state->machine() || ((state->machine() != machine()) && !qobject_cast<QStateMachine*>(this)))) {
        qWarning("QState::setErrorState: error state cannot belong "
                 "to a different state machine");
        return;
    }

    if (d->errorState != state) {
        d->errorState = state;
        emit errorStateChanged(QState::QPrivateSignal());
    }
}