~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/libs/qmljs/parser/qmlerror.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
    QmlError includes a textual description of the error, as well
46
46
    as location information (the file, line, and column). The toString()
47
 
    function creates a single-line, human-readable string containing all of
 
47
    method creates a single-line, human-readable string containing all of
48
48
    this information, for example:
49
49
    \code
50
50
    file:///home/user/test.qml:7:8: Invalid property assignment: double expected
51
51
    \endcode
52
52
 
53
 
    You can use qDebug() or qWarning() to output errors to the console. This function
 
53
    You can use qDebug() or qWarning() to output errors to the console. This method
54
54
    will attempt to open the file indicated by the error
55
55
    and include additional contextual information.
56
56
    \code
59
59
               ^
60
60
    \endcode
61
61
 
62
 
    \note The QtQuick 1 version is named QDeclarativeError.
 
62
    Note that the \l {Qt Quick 1} version is named QDeclarativeError
63
63
 
64
64
    \sa QQuickView::errors(), QmlComponent::errors()
65
65
*/
78
78
    QString description;
79
79
    quint16 line;
80
80
    quint16 column;
 
81
    QObject *object;
81
82
};
82
83
 
83
84
QmlErrorPrivate::QmlErrorPrivate()
84
 
: line(0), column(0)
 
85
: line(0), column(0), object()
85
86
{
86
87
}
87
88
 
116
117
        d->description = other.d->description;
117
118
        d->line = other.d->line;
118
119
        d->column = other.d->column;
 
120
        d->object = other.d->object;
119
121
    }
120
122
    return *this;
121
123
}
137
139
}
138
140
 
139
141
/*!
140
 
    Returns the URL for the file that caused this error.
 
142
    Returns the url for the file that caused this error.
141
143
*/
142
144
QUrl QmlError::url() const
143
145
{
209
211
}
210
212
 
211
213
/*!
 
214
    Returns the nearest object where this error occurred.
 
215
    Exceptions in bound property expressions set this to the object
 
216
    to which the property belongs. It will be 0 for all
 
217
    other exceptions.
 
218
 */
 
219
QObject *QmlError::object() const
 
220
{
 
221
    if (d) return d->object;
 
222
    else return 0;
 
223
}
 
224
 
 
225
/*!
 
226
    Sets the nearest \a object where this error occurred.
 
227
 */
 
228
void QmlError::setObject(QObject *object)
 
229
{
 
230
    if (!d) d = new QmlErrorPrivate;
 
231
    d->object = object;
 
232
}
 
233
 
 
234
/*!
212
235
    Returns the error as a human readable string.
213
236
*/
214
237
QString QmlError::toString() const
237
260
 
238
261
/*!
239
262
    \relates QmlError
 
263
    \fn QDebug operator<<(QDebug debug, const QmlError &error)
240
264
 
241
265
    Outputs a human readable version of \a error to \a debug.
242
266
*/