diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-04 16:34:48 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-05 17:10:36 +0100 |
commit | 808f17756887d2fc95d526ee4aec741cb5730fad (patch) | |
tree | d4e5e98e6ab54692d0ab67a4a7f1a19259ee2735 /src/qml/qml/qqmlboundsignal.cpp | |
parent | 3c9a2d3903e8718e6354f8bcfffe9d04f782ca06 (diff) |
Add some leading white space to generated code for QML signals.
Like this the column numbers in the generated code are correct. We rely
on the column numbers in quite a few places.
The alternative solution of extending the Javascript parser to add an
initial column offset would result in much more code and complexity.
const-casting the column number and adding to it after compiling would
be an option but as the column number may be saved in other places, too,
this is not desirable.
Task-number: QTBUG-37226
Change-Id: I0d11816d96ff4e7c756064646755a3e9874f9790
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index f7ece53121..a5e23978d7 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -188,7 +188,10 @@ void QQmlBoundSignalExpression::evaluate(void **a) Q_ASSERT(!m_extra.isNull()); QString expression; - expression = QStringLiteral("(function "); + // Add some leading whitespace to account for the binding's column offset. + // It's 2 off because a, we start counting at 1 and b, the '(' below is not counted. + expression.fill(QChar(QChar::Space), qMax(m_extra->m_sourceLocation.column, (quint16)2) - 2); + expression += QStringLiteral("(function "); expression += m_extra->m_handlerName; expression += QLatin1Char('('); |