summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-19 05:58:18 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-19 05:58:18 (GMT)
commit3cbf3d43c95fafc38294513d333d29baaf553027 (patch)
treedc31d3d607624e62b8c8197e958323366ccf1684 /src
parentf0f740fadaa4c368df5743502f445f9ce0de1247 (diff)
parent8e414cb69e1d27b66f51cd68a7126c5ac647c974 (diff)
downloadQt-3cbf3d43c95fafc38294513d333d29baaf553027.zip
Qt-3cbf3d43c95fafc38294513d333d29baaf553027.tar.gz
Qt-3cbf3d43c95fafc38294513d333d29baaf553027.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp34
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp9
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp12
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h3
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp1
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp6
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h3
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp9
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp103
-rw-r--r--src/declarative/qml/qdeclarativeengine.h7
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h8
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeerror.cpp12
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp119
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h19
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp8
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp9
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject.cpp14
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp8
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp7
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp5
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent.cpp5
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp3
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/testlib/qtestlightxmlstreamer.cpp3
-rw-r--r--src/testlib/qtestlogger.cpp3
-rw-r--r--src/testlib/qtestxmlstreamer.cpp3
40 files changed, 317 insertions, 156 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 6ab126d..c81c2d2 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -44,6 +44,7 @@
#ifndef QT_NO_MOVIE
+#include <qdeclarativeinfo.h>
#include <qdeclarativeengine.h>
#include <QMovie>
@@ -213,7 +214,7 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url)
//### should be unified with movieRequestFinished
d->_movie = new QMovie(lf);
if (!d->_movie->isValid()){
- qWarning() << "Error Reading Animated Image File" << d->url;
+ qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString();
delete d->_movie;
d->_movie = 0;
return;
@@ -270,7 +271,7 @@ void QDeclarativeAnimatedImage::movieRequestFinished()
d->_movie = new QMovie(d->reply);
if (!d->_movie->isValid()){
- qWarning() << "Error Reading Animated Image File " << d->url;
+ qmlInfo(this) << "Error Reading Animated Image File " << d->url;
delete d->_movie;
d->_movie = 0;
return;
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 7858a7a..06f8363 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -264,9 +264,9 @@ void QDeclarativeBorderImage::load()
When the image is scaled:
\list
\i the corners (sections 1, 3, 7, and 9) are not scaled at all
- \i the middle (section 5) is scaled according to BorderImage::horizontalTileMode and BorderImage::verticalTileMode
- \i sections 2 and 8 are scaled according to BorderImage::horizontalTileMode
- \i sections 4 and 6 are scaled according to BorderImage::verticalTileMode
+ \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode}
+ \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode}
+ \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode}
\endlist
Each border line (left, right, top, and bottom) specifies an offset from the respective side. For example, \c{border.bottom: 10} sets the bottom line 10 pixels up from the bottom of the image.
@@ -282,8 +282,8 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border()
}
/*!
- \qmlproperty TileMode BorderImage::horizontalTileMode
- \qmlproperty TileMode BorderImage::verticalTileMode
+ \qmlproperty enumeration BorderImage::horizontalTileMode
+ \qmlproperty enumeration BorderImage::verticalTileMode
This property describes how to repeat or stretch the middle parts of the border image.
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 37b07bf..247e348 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -236,9 +236,12 @@ qreal QDeclarativeImage::paintedHeight() const
to react to the change in status you need to do it yourself, for example in one
of the following ways:
\list
- \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: image.status = Image.Ready;}
- \o Do something inside the onStatusChanged signal handler, e.g. Image{id: image; onStatusChanged: if(image.status == Image.Ready) console.log('Loaded');}
- \o Bind to the status variable somewhere, e.g. Text{text: if(image.status!=Image.Ready){'Not Loaded';}else{'Loaded';}}
+ \o Create a state, so that a state change occurs, e.g.
+ \qml State { name: 'loaded'; when: image.status = Image.Ready } \endqml
+ \o Do something inside the onStatusChanged signal handler, e.g.
+ \qml Image { id: image; onStatusChanged: if (image.status == Image.Ready) console.log('Loaded') } \endqml
+ \o Bind to the status variable somewhere, e.g.
+ \qml Text { text: if (image.status != Image.Ready) { 'Not Loaded' } else { 'Loaded' } } \endqml
\endlist
\sa progress
@@ -366,12 +369,27 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi
if (width() != d->pix.width() || height() != d->pix.height()) {
if (d->fillMode >= Tile) {
- if (d->fillMode == Tile)
+ if (d->fillMode == Tile) {
p->drawTiledPixmap(QRectF(0,0,width(),height()), d->pix);
- else if (d->fillMode == TileVertically)
- p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix);
- else
- p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix);
+ } else {
+ qreal widthScale = width() / qreal(d->pix.width());
+ qreal heightScale = height() / qreal(d->pix.height());
+
+ QTransform scale;
+ if (d->fillMode == TileVertically) {
+ scale.scale(widthScale, 1.0);
+ QTransform old = p->transform();
+ p->setWorldTransform(scale * old);
+ p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix);
+ p->setWorldTransform(old);
+ } else {
+ scale.scale(1.0, heightScale);
+ QTransform old = p->transform();
+ p->setWorldTransform(scale * old);
+ p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix);
+ p->setWorldTransform(old);
+ }
+ }
} else {
qreal widthScale = width() / qreal(d->pix.width());
qreal heightScale = height() / qreal(d->pix.height());
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 843dfdc..37c7923 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2242,7 +2242,7 @@ QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qr
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
QDeclarativeItem *itemObj = qobject_cast<QDeclarativeItem*>(item.toQObject());
if (!itemObj && !item.isNull()) {
- qWarning().nospace() << "mapFromItem() given argument " << item.toString() << " which is neither null nor an Item";
+ qmlInfo(this) << "mapFromItem() given argument \"" << item.toString() << "\" which is neither null nor an Item";
return 0;
}
@@ -2268,7 +2268,7 @@ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qrea
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
QDeclarativeItem *itemObj = qobject_cast<QDeclarativeItem*>(item.toQObject());
if (!itemObj && !item.isNull()) {
- qWarning().nospace() << "mapToItem() given argument " << item.toString() << " which is neither null nor an Item";
+ qmlInfo(this) << "mapToItem() given argument \"" << item.toString() << "\" which is neither null nor an Item";
return 0;
}
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 8cf8235..3f257b5 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -277,7 +277,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
if (component) {
if (!component->errors().isEmpty()) {
- qWarning() << component->errors();
+ QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
@@ -312,7 +312,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
}
} else {
if (!component->errors().isEmpty())
- qWarning() << component->errors();
+ QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
delete obj;
delete ctxt;
source = QUrl();
diff --git a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
index e68f645..fe89190 100644
--- a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
@@ -175,7 +175,7 @@ QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::stringToRule(cons
if (s == QLatin1String("Round"))
return QDeclarativeBorderImage::Round;
- qWarning() << "Unknown tile rule specified. Using Stretch";
+ qWarning("QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch.");
return QDeclarativeBorderImage::Stretch;
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 1fec484..77fb459 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -614,7 +614,7 @@ void QDeclarativeTextEdit::loadCursorDelegate()
d->cursor->setHeight(QFontMetrics(d->font).height());
moveCursorDelegate();
}else{
- qWarning() << QLatin1String("Error loading cursor delegate for TextEdit:") + objectName();
+ qmlInfo(this) << "Error loading cursor delegate.";
}
}
@@ -1076,8 +1076,6 @@ void QDeclarativeTextEditPrivate::updateSelection()
q->selectionEndChanged();
startChange = (lastSelectionStart != control->textCursor().selectionStart());
endChange = (lastSelectionEnd != control->textCursor().selectionEnd());
- if(startChange || endChange)
- qWarning() << "QDeclarativeTextEditPrivate::updateSelection() has failed you.";
}
void QDeclarativeTextEdit::updateSelectionMarkers()
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index e00d333..2161e23 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -779,9 +779,8 @@ void QDeclarativeTextInputPrivate::startCreatingCursor()
}else if(cursorComponent->isLoading()){
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
- }else{//isError
- qmlInfo(q) << QDeclarativeTextInput::tr("Could not load cursor delegate");
- qWarning() << cursorComponent->errors();
+ }else {//isError
+ qmlInfo(q, cursorComponent->errors()) << QDeclarativeTextInput::tr("Could not load cursor delegate");
}
}
@@ -789,8 +788,7 @@ void QDeclarativeTextInput::createCursor()
{
Q_D(QDeclarativeTextInput);
if(d->cursorComponent->isError()){
- qmlInfo(this) << tr("Could not load cursor delegate");
- qWarning() << d->cursorComponent->errors();
+ qmlInfo(this, d->cursorComponent->errors()) << tr("Could not load cursor delegate");
return;
}
@@ -801,8 +799,7 @@ void QDeclarativeTextInput::createCursor()
delete d->cursorItem;
d->cursorItem = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create());
if(!d->cursorItem){
- qmlInfo(this) << tr("Could not instantiate cursor delegate");
- //The failed instantiation should print its own error messages
+ qmlInfo(this, d->cursorComponent->errors()) << tr("Could not instantiate cursor delegate");
return;
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 751284d..207232d 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -1011,7 +1011,7 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
} else {
delete data;
delete ctxt;
- qWarning() << d->m_delegate->errors();
+ qmlInfo(this, d->m_delegate->errors()) << "Error creating delgate";
}
}
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 25492ac..d759427 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -210,8 +210,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
}
if (data->error.isValid()) {
- if (!data->addError(ep))
- qWarning().nospace() << qPrintable(this->error().toString());
+ if (!data->addError(ep)) ep->warning(this->error());
} else {
data->removeError();
}
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 8c7a977..00a93cc 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -179,7 +179,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
if (m_expression && m_expression->engine()) {
QDeclarativeExpressionPrivate::get(m_expression)->value(m_params);
if (m_expression && m_expression->hasError())
- qWarning().nospace() << qPrintable(m_expression->error().toString());
+ QDeclarativeEnginePrivate::warning(m_expression->engine(), m_expression->error());
}
if (m_params) m_params->clearValues();
return -1;
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 6fdf706..4a47fc6 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -938,7 +938,7 @@ static void throwException(int id, QDeclarativeDelayedError *error,
error->error.setColumn(-1);
}
if (!context->engine || !error->addError(QDeclarativeEnginePrivate::get(context->engine)))
- qWarning() << error->error;
+ QDeclarativeEnginePrivate::warning(context->engine, error->error);
}
static void dumpInstruction(const Instr *instr)
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 065009a..cced7b1 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1218,7 +1218,14 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script)
{
- qWarning().nospace() << qPrintable(output->url.toString()) << ":" << obj->location.start.line << ":" << obj->location.start.column << ": Script blocks have been deprecated. Support will be removed entirely shortly.";
+ {
+ QDeclarativeError warning;
+ warning.setUrl(output->url);
+ warning.setLine(obj->location.start.line);
+ warning.setColumn(obj->location.start.column);
+ warning.setDescription(tr("Script blocks have been deprecated. Support will be removed entirely shortly."));
+ qWarning() << warning.toString();
+ }
Object::ScriptBlock scriptBlock;
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 3e4651c..c86f089 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -530,10 +530,8 @@ QScriptValue QDeclarativeComponent::createObject()
{
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
- if(!ctxt){
- qWarning() << QLatin1String("createObject can only be used in QML");
+ if(!ctxt)
return QScriptValue();
- }
QObject* ret = create(ctxt);
if (!ret)
return QScriptValue();
@@ -613,17 +611,17 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons
{
Q_Q(QDeclarativeComponent);
if (!context) {
- qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in a null context");
+ qWarning("QDeclarativeComponent: Cannot create a component in a null context");
return 0;
}
if (!context->isValid()) {
- qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in an invalid context");
+ qWarning("QDeclarativeComponent: Cannot create a component in an invalid context");
return 0;
}
if (context->engine != engine) {
- qWarning("QDeclarativeComponent::beginCreate(): Must create component in context from the same QDeclarativeEngine");
+ qWarning("QDeclarativeComponent: Must create component in context from the same QDeclarativeEngine");
return 0;
}
@@ -766,7 +764,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
enginePriv->inProgressCreations--;
if (0 == enginePriv->inProgressCreations) {
while (enginePriv->erroredBindings) {
- qWarning().nospace() << qPrintable(enginePriv->erroredBindings->error.toString());
+ enginePriv->warning(enginePriv->erroredBindings->error);
enginePriv->erroredBindings->removeError();
}
}
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index 6ee5070..526a319 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -99,8 +99,6 @@ public:
virtual QObject *beginCreate(QDeclarativeContext *);
virtual void completeCreate();
- Q_INVOKABLE QScriptValue createObject();
-
void loadUrl(const QUrl &url);
void setData(const QByteArray &, const QUrl &baseUrl);
@@ -114,6 +112,7 @@ Q_SIGNALS:
protected:
QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
+ Q_INVOKABLE QScriptValue createObject();
private:
QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 133b71f..adeb7a5 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -341,7 +341,6 @@ static QString toLocalFileOrQrc(const QUrl& url)
if (url.scheme() == QLatin1String("qrc")) {
if (url.authority().isEmpty())
return QLatin1Char(':') + url.path();
- qWarning() << "Invalid url:" << url.toString() << "authority" << url.authority() << "not known.";
return QString();
}
return url.toLocalFile();
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index 5288923..31430c7 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -660,7 +660,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
if (scriptEngine->hasUncaughtException()) {
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
+ enginePriv->warning(error);
}
scriptEngine->popContext();
@@ -686,7 +686,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
if (scriptEngine->hasUncaughtException()) {
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
+ enginePriv->warning(error);
}
scriptEngine->popContext();
@@ -720,7 +720,7 @@ void QDeclarativeContextData::addScript(const QDeclarativeParser::Object::Script
if (scriptEngine->hasUncaughtException()) {
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
+ enginePriv->warning(error);
}
}
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 2ddd7e5..4a56536 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -75,7 +75,7 @@ public:
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0),
bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0),
- attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {
+ attachedProperties(0), scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0) {
init();
}
@@ -128,6 +128,7 @@ public:
// ### Can we make this QScriptValuePrivate so we incur no additional allocation
// cost?
QScriptValue *scriptValue;
+ quint32 objectDataRefCount;
QDeclarativePropertyCache *propertyCache;
QDeclarativeGuard<QObject> *guards;
diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp
index 1e3b37b..3e05853 100644
--- a/src/declarative/qml/qdeclarativedirparser.cpp
+++ b/src/declarative/qml/qdeclarativedirparser.cpp
@@ -170,10 +170,9 @@ bool QDeclarativeDirParser::parse()
const int dotIndex = version.indexOf(QLatin1Char('.'));
if (dotIndex == -1) {
- qWarning() << "expected '.'"; // ### use reportError
+ reportError(lineNumber, -1, QLatin1String("expected '.'"));
} else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
- qWarning() << "unexpected '.'"; // ### use reportError
-
+ reportError(lineNumber, -1, QLatin1String("unexpected '.'"));
} else {
bool validVersionNumber = false;
const int majorVersion = version.left(dotIndex).toInt(&validVersionNumber);
@@ -189,8 +188,8 @@ bool QDeclarativeDirParser::parse()
}
}
} else {
- // ### use reportError
- qWarning() << "a component declaration requires 3 arguments, but" << (sectionCount + 1) << "were provided";
+ reportError(lineNumber, -1,
+ QString::fromUtf8("a component declaration requires 3 arguments, but %1 were provided").arg(sectionCount + 1));
}
}
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 4dbd199..9cd6b3c 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -153,10 +153,10 @@ void QDeclarativeEnginePrivate::defineModule()
QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), currentExpression(0), isDebugging(false),
- contextClass(0), sharedContext(0), sharedScope(0), objectClass(0), valueTypeClass(0),
- globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0),
- scriptEngine(this), workerScriptEngine(0), componentAttached(0), inBeginCreate(false),
- networkAccessManager(0), networkAccessManagerFactory(0),
+ outputWarningsToStdErr(true), contextClass(0), sharedContext(0), sharedScope(0),
+ objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0),
+ inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttached(0),
+ inBeginCreate(false), networkAccessManager(0), networkAccessManagerFactory(0),
typeManager(e), uniqueId(1)
{
if (!qt_QmlQtModule_registered) {
@@ -216,8 +216,6 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator())
+ QDir::separator() + QLatin1String("QML")
+ QDir::separator() + QLatin1String("OfflineStorage");
-#else
- qWarning("offlineStoragePath is not set by default with QT_NO_DESKTOPSERVICES");
#endif
qt_add_qmlxmlhttprequest(this);
@@ -650,6 +648,34 @@ void QDeclarativeEngine::setBaseUrl(const QUrl &url)
{
Q_D(QDeclarativeEngine);
d->baseUrl = url;
+}
+
+/*!
+ Returns true if warning messages will be output to stderr in addition
+ to being emitted by the warnings() signal, otherwise false.
+
+ The default value is true.
+*/
+bool QDeclarativeEngine::outputWarningsToStandardError() const
+{
+ Q_D(const QDeclarativeEngine);
+ return d->outputWarningsToStdErr;
+}
+
+/*!
+ Set whether warning messages will be output to stderr to \a enabled.
+
+ If \a enabled is true, any warning messages generated by QML will be
+ output to stderr and emitted by the warnings() signal. If \a enabled
+ is false, on the warnings() signal will be emitted. This allows
+ applications to handle warning output themselves.
+
+ The default value is true.
+*/
+void QDeclarativeEngine::setOutputWarningsToStandardError(bool enabled)
+{
+ Q_D(QDeclarativeEngine);
+ d->outputWarningsToStdErr = enabled;
}
/*!
@@ -777,9 +803,8 @@ void qmlExecuteDeferred(QObject *object)
QDeclarativeComponentPrivate::complete(ep, &state);
- if (!state.errors.isEmpty())
- qWarning() << state.errors;
-
+ if (!state.errors.isEmpty())
+ ep->warning(state.errors);
}
}
@@ -1295,6 +1320,65 @@ void QDeclarativeEnginePrivate::sendQuit()
emit q->quit();
}
+static void dumpwarning(const QDeclarativeError &error)
+{
+ qWarning().nospace() << qPrintable(error.toString());
+}
+
+static void dumpwarning(const QList<QDeclarativeError> &errors)
+{
+ for (int ii = 0; ii < errors.count(); ++ii)
+ dumpwarning(errors.at(ii));
+}
+
+void QDeclarativeEnginePrivate::warning(const QDeclarativeError &error)
+{
+ Q_Q(QDeclarativeEngine);
+ q->warnings(QList<QDeclarativeError>() << error);
+ if (outputWarningsToStdErr)
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(const QList<QDeclarativeError> &errors)
+{
+ Q_Q(QDeclarativeEngine);
+ q->warnings(errors);
+ if (outputWarningsToStdErr)
+ dumpwarning(errors);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEngine *engine, const QDeclarativeError &error)
+{
+ if (engine)
+ QDeclarativeEnginePrivate::get(engine)->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEngine *engine, const QList<QDeclarativeError> &error)
+{
+ if (engine)
+ QDeclarativeEnginePrivate::get(engine)->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const QDeclarativeError &error)
+{
+ if (engine)
+ engine->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const QList<QDeclarativeError> &error)
+{
+ if (engine)
+ engine->warning(error);
+ else
+ dumpwarning(error);
+}
+
QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
{
QDeclarativeEnginePrivate *qe = get (e);
@@ -1415,7 +1499,6 @@ static QString toLocalFileOrQrc(const QUrl& url)
if (url.scheme() == QLatin1String("qrc")) {
if (url.authority().isEmpty())
return QLatin1Char(':') + url.path();
- qWarning() << "Invalid url:" << url.toString() << "authority" << url.authority() << "not known.";
return QString();
}
return url.toLocalFile();
diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h
index 7b058ea..e161cd9 100644
--- a/src/declarative/qml/qdeclarativeengine.h
+++ b/src/declarative/qml/qdeclarativeengine.h
@@ -46,6 +46,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qmap.h>
#include <QtScript/qscriptvalue.h>
+#include <QtDeclarative/qdeclarativeerror.h>
QT_BEGIN_HEADER
@@ -102,6 +103,9 @@ public:
QUrl baseUrl() const;
void setBaseUrl(const QUrl &);
+ bool outputWarningsToStandardError() const;
+ void setOutputWarningsToStandardError(bool);
+
static QDeclarativeContext *contextForObject(const QObject *);
static void setContextForObject(QObject *, QDeclarativeContext *);
@@ -110,7 +114,8 @@ public:
static ObjectOwnership objectOwnership(QObject *);
Q_SIGNALS:
- void quit ();
+ void quit();
+ void warnings(const QList<QDeclarativeError> &warnings);
private:
Q_DECLARE_PRIVATE(QDeclarativeEngine)
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 43d329c..f6b9bcb 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -162,6 +162,8 @@ public:
QDeclarativeExpression *currentExpression;
bool isDebugging;
+ bool outputWarningsToStdErr;
+
struct ImportedNamespace;
QDeclarativeContextScriptClass *contextClass;
QDeclarativeContextData *sharedContext;
@@ -312,6 +314,12 @@ public:
QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid);
void sendQuit();
+ void warning(const QDeclarativeError &);
+ void warning(const QList<QDeclarativeError> &);
+ static void warning(QDeclarativeEngine *, const QDeclarativeError &);
+ static void warning(QDeclarativeEngine *, const QList<QDeclarativeError> &);
+ static void warning(QDeclarativeEnginePrivate *, const QDeclarativeError &);
+ static void warning(QDeclarativeEnginePrivate *, const QList<QDeclarativeError> &);
static QScriptValue qmlScriptObject(QObject*, QDeclarativeEngine*);
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 578733c..264fd8d 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -308,8 +308,6 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
QByteArray type;
ds >> type;
- //qDebug() << "QDeclarativeEngineDebugServer::messageReceived()" << type;
-
if (type == "LIST_ENGINES") {
int queryId;
ds >> queryId;
diff --git a/src/declarative/qml/qdeclarativeerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp
index 17e91e3..8717f56 100644
--- a/src/declarative/qml/qdeclarativeerror.cpp
+++ b/src/declarative/qml/qdeclarativeerror.cpp
@@ -216,9 +216,15 @@ void QDeclarativeError::setColumn(int column)
QString QDeclarativeError::toString() const
{
QString rv;
- rv = url().toString() + QLatin1Char(':') + QString::number(line());
- if(column() != -1)
- rv += QLatin1Char(':') + QString::number(column());
+ if (url().isEmpty()) {
+ rv = QLatin1String("<Unknown File>");
+ } else if (line() != -1) {
+ rv = url().toString() + QLatin1Char(':') + QString::number(line());
+ if(column() != -1)
+ rv += QLatin1Char(':') + QString::number(column());
+ } else {
+ rv = url().toString();
+ }
rv += QLatin1String(": ") + description();
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 05240a2..8b5a62f 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -695,14 +695,13 @@ void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEn
if (!outputWarningHeader) {
outputWarningHeader = true;
qWarning() << "QDeclarativeExpression: Expression" << q->expression()
- << "depends on non-NOTIFYable properties:";
+ << "depends on non-NOTIFYable properties:";
}
const QMetaObject *metaObj = property.object->metaObject();
QMetaProperty metaProp = metaObj->property(property.coreIndex);
- qWarning().nospace() << " " << metaObj->className()
- << "::" << metaProp.name();
+ qWarning().nospace() << " " << metaObj->className() << "::" << metaProp.name();
}
}
}
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index 0a4352f..f6560a6 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -45,6 +45,7 @@
#include "qdeclarativecontext.h"
#include "private/qdeclarativecontext_p.h"
#include "private/qdeclarativemetatype_p.h"
+#include "private/qdeclarativeengine_p.h"
#include <QCoreApplication>
@@ -77,52 +78,94 @@ QT_BEGIN_NAMESPACE
\endcode
*/
+struct QDeclarativeInfoPrivate
+{
+ const QObject *object;
+ QString *buffer;
+ QList<QDeclarativeError> errors;
+};
+
QDeclarativeInfo::QDeclarativeInfo(const QObject *object)
-: QDebug(QtWarningMsg)
+: QDebug((*(QString **)&d) = new QString)
{
- QString pos = QLatin1String("QML");
- if (object) {
- pos += QLatin1Char(' ');
-
- QString typeName;
- QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
- if (type) {
- typeName = QLatin1String(type->qmlTypeName());
- int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
- if (lastSlash != -1)
- typeName = typeName.mid(lastSlash+1);
- } else {
- typeName = QString::fromUtf8(object->metaObject()->className());
- int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
- if (marker != -1)
- typeName = typeName.left(marker);
- }
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
- pos += typeName;
- }
- QDeclarativeData *ddata = object?QDeclarativeData::get(object):0;
- pos += QLatin1String(" (");
- if (ddata) {
- if (ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
- pos += ddata->outerContext->url.toString();
- pos += QLatin1Char(':');
- pos += QString::number(ddata->lineNumber);
- pos += QLatin1Char(':');
- pos += QString::number(ddata->columnNumber);
- } else {
- pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
- }
- } else {
- pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
- }
- pos += QLatin1Char(')');
- *this << pos;
+ d->object = object;
nospace();
}
-QDeclarativeInfo::~QDeclarativeInfo()
+QDeclarativeInfo::QDeclarativeInfo(const QObject *object, const QList<QDeclarativeError> &errors)
+: QDebug((*(QString **)&d) = new QString)
{
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
+
+ d->object = object;
+ d->errors = errors;
+ nospace();
}
+QDeclarativeInfo::QDeclarativeInfo(const QObject *object, const QDeclarativeError &error)
+: QDebug((*(QString **)&d) = new QString)
+{
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
+
+ d->object = object;
+ d->errors << error;
+ nospace();
+}
+
+QDeclarativeInfo::~QDeclarativeInfo()
+{
+ QList<QDeclarativeError> errors = d->errors;
+
+ QDeclarativeEngine *engine = 0;
+
+ if (!d->buffer->isEmpty()) {
+ QDeclarativeError error;
+
+ QObject *object = const_cast<QObject *>(d->object);
+
+ if (object) {
+ engine = qmlEngine(d->object);
+ QString typeName;
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
+ if (type) {
+ typeName = QLatin1String(type->qmlTypeName());
+ int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash != -1)
+ typeName = typeName.mid(lastSlash+1);
+ } else {
+ typeName = QString::fromUtf8(object->metaObject()->className());
+ int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
+ if (marker != -1)
+ typeName = typeName.left(marker);
+ }
+
+ d->buffer->prepend(QLatin1String("QML ") + typeName + QLatin1String(": "));
+
+ QDeclarativeData *ddata = QDeclarativeData::get(object, false);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
+ error.setUrl(ddata->outerContext->url);
+ error.setLine(ddata->lineNumber);
+ error.setColumn(ddata->columnNumber);
+ }
+ }
+
+ error.setDescription(*d->buffer);
+
+ errors.prepend(error);
+ }
+
+ QDeclarativeEnginePrivate::warning(engine, errors);
+
+ delete d->buffer;
+ delete d;
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
index 8f69f73..3d5a111 100644
--- a/src/declarative/qml/qdeclarativeinfo.h
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -43,6 +43,8 @@
#define QDECLARATIVEINFO_H
#include <QtCore/qdebug.h>
+#include <QtCore/qurl.h>
+#include <QtDeclarative/qdeclarativeerror.h>
QT_BEGIN_HEADER
@@ -50,10 +52,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QDeclarativeInfoPrivate;
class Q_DECLARATIVE_EXPORT QDeclarativeInfo : public QDebug
{
public:
QDeclarativeInfo(const QObject *);
+ QDeclarativeInfo(const QObject *, const QDeclarativeError &);
+ QDeclarativeInfo(const QObject *, const QList<QDeclarativeError> &);
~QDeclarativeInfo();
inline QDeclarativeInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; }
@@ -78,6 +83,10 @@ public:
inline QDeclarativeInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; }
+ inline QDeclarativeInfo &operator<<(const QUrl &t) { static_cast<QDebug &>(*this) << t; return *this; }
+
+private:
+ QDeclarativeInfoPrivate *d;
};
Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me)
@@ -85,6 +94,16 @@ Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me)
return QDeclarativeInfo(me);
}
+Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me, const QDeclarativeError &error)
+{
+ return QDeclarativeInfo(me, error);
+}
+
+Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDeclarativeError> &errors)
+{
+ return QDeclarativeInfo(me, errors);
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index 7b71608..d41bd43 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -403,10 +403,8 @@ int QDeclarativeType::index() const
int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &interface)
{
- if (interface.version > 0) {
- qWarning("Cannot mix incompatible QML versions.");
- return -1;
- }
+ if (interface.version > 0)
+ qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
QWriteLocker lock(metaTypeDataLock());
QDeclarativeMetaTypeData *data = metaTypeData();
@@ -437,7 +435,7 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &t
if (type.elementName) {
for (int ii = 0; type.elementName[ii]; ++ii) {
if (!isalnum(type.elementName[ii])) {
- qWarning("QDeclarativeMetaType: Invalid QML element name %s", type.elementName);
+ qWarning("qmlRegisterType(): Invalid QML element name \"%s\"", type.elementName);
return -1;
}
}
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 5773fe6..a27d19d 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -59,12 +59,17 @@ Q_DECLARE_METATYPE(QScriptValue);
QT_BEGIN_NAMESPACE
struct ObjectData : public QScriptDeclarativeClass::Object {
- ObjectData(QObject *o, int t) : object(o), type(t) {}
+ ObjectData(QObject *o, int t) : object(o), type(t) {
+ if (o) {
+ QDeclarativeData *ddata = QDeclarativeData::get(object, true);
+ if (ddata) ddata->objectDataRefCount++;
+ }
+ }
virtual ~ObjectData() {
if (object && !object->parent()) {
QDeclarativeData *ddata = QDeclarativeData::get(object, false);
- if (ddata && !ddata->indestructible)
+ if (ddata && !ddata->indestructible && 0 == --ddata->objectDataRefCount)
object->deleteLater();
}
}
diff --git a/src/declarative/qml/qdeclarativeproxymetaobject.cpp b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
index fe0dce7..c2dce0a 100644
--- a/src/declarative/qml/qdeclarativeproxymetaobject.cpp
+++ b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
@@ -41,17 +41,11 @@
#include "private/qdeclarativeproxymetaobject_p.h"
-#include <QDebug>
-
QT_BEGIN_NAMESPACE
QDeclarativeProxyMetaObject::QDeclarativeProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
: metaObjects(mList), proxies(0), parent(0), object(obj)
{
-#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
- qWarning() << "QDeclarativeProxyMetaObject" << obj->metaObject()->className();
-#endif
-
*static_cast<QMetaObject *>(this) = *metaObjects->first().metaObject;
QObjectPrivate *op = QObjectPrivate::get(obj);
@@ -59,14 +53,6 @@ QDeclarativeProxyMetaObject::QDeclarativeProxyMetaObject(QObject *obj, QList<Pro
parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
op->metaObject = this;
-
-#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
- const QMetaObject *mo = obj->metaObject();
- while(mo) {
- qWarning() << " " << mo->className();
- mo = mo->superClass();
- }
-#endif
}
QDeclarativeProxyMetaObject::~QDeclarativeProxyMetaObject()
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index be2a1a7..b7e1832 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -1305,7 +1305,7 @@ void QDeclarativeXMLHttpRequest::printError(const QScriptValue& sv)
{
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(sv.engine(), error);
- qWarning().nospace() << qPrintable(error.toString());
+ QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate::get(sv.engine()), error);
}
void QDeclarativeXMLHttpRequest::destroyNetwork()
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index fd85d91..5f81b26 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -185,7 +185,7 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
return;
if (d->group || d->disableUserControl) {
- qWarning("QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ qmlInfo(this) << "setRunning() cannot be used on non-root animation nodes.";
return;
}
@@ -245,7 +245,7 @@ void QDeclarativeAbstractAnimation::setPaused(bool p)
return;
if (d->group || d->disableUserControl) {
- qWarning("QDeclarativeAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
+ qmlInfo(this) << "setPaused() cannot be used on non-root animation nodes.";
return;
}
@@ -781,8 +781,8 @@ void QDeclarativeScriptActionPrivate::execute()
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
- if (expr.hasError())
- qWarning() << expr.error();
+ if (expr.hasError())
+ qmlInfo(q) << expr.error();
}
}
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 41740a8..4115193 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -53,6 +53,7 @@
#include <QFontDatabase>
#include <private/qobject_p.h>
+#include <qdeclarativeinfo.h>
QT_BEGIN_NAMESPACE
@@ -136,7 +137,7 @@ void QDeclarativeFontLoader::setSource(const QUrl &url)
d->status = QDeclarativeFontLoader::Ready;
} else {
d->status = QDeclarativeFontLoader::Error;
- qWarning() << "Cannot load font:" << url;
+ qmlInfo(this) << "Cannot load font: \"" << url.toString() << "\"";
}
emit statusChanged();
} else
@@ -231,7 +232,7 @@ void QDeclarativeFontLoader::replyFinished()
d->addFontToDatabase(ba);
} else {
d->status = Error;
- qWarning() << "Cannot load font:" << d->reply->url();
+ qmlInfo(this) << "Cannot load font: \"" << d->reply->url().toString() << "\"";
emit statusChanged();
}
d->reply->deleteLater();
@@ -250,7 +251,7 @@ void QDeclarativeFontLoaderPrivate::addFontToDatabase(const QByteArray &ba)
status = QDeclarativeFontLoader::Ready;
} else {
status = QDeclarativeFontLoader::Error;
- qWarning() << "Cannot load font:" << url;
+ qmlInfo(q) << "Cannot load font: \"" << url.toString() << "\"";
}
emit q->statusChanged();
}
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 2616ccf..6e980d0 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -1187,10 +1187,9 @@ QScriptValue NestedListModel::get(int index) const
if (!node)
return 0;
QDeclarativeEngine *eng = qmlEngine(m_listModel);
- if (!eng) {
- qWarning("Cannot call QDeclarativeListModel::get() without a QDeclarativeEngine");
+ if (!eng)
return 0;
- }
+
return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng);
}
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
index d91b107..534c923 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
@@ -202,10 +202,9 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
FlatListModel *orig = m_orig->m_flat;
FlatListModel *copy = s->list->m_flat;
- if (!orig || !copy) {
- qWarning("QML ListModel worker: sync() failed");
+ if (!orig || !copy)
return QObject::event(e);
- }
+
orig->m_roles = copy->m_roles;
orig->m_strings = copy->m_strings;
orig->m_values = copy->m_values;
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index ff78c60..81f4230 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -50,6 +50,7 @@
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
+#include <qdeclarativeinfo.h>
QT_BEGIN_NAMESPACE
@@ -381,7 +382,7 @@ void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state
}
if (applyingState) {
- qWarning() << "Can't apply a state change as part of a state definition.";
+ qmlInfo(q) << "Can't apply a state change as part of a state definition.";
return;
}
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 3854b10..eb6ac7b 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -577,7 +577,7 @@ void QDeclarativeStateChangeScript::execute()
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
if (expr.hasError())
- qWarning() << expr.error();
+ qmlInfo(this, expr.error());
}
}
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp
index 8c22a4f..0ac9ea8 100644
--- a/src/testlib/qtestlightxmlstreamer.cpp
+++ b/src/testlib/qtestlightxmlstreamer.cpp
@@ -87,13 +87,12 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBu
QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
- QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <DataTag>%s</DataTag><Description><![CDATA[%s]]></Description>\n</Message>\n",
+ QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
element->attributeValue(QTest::AI_Type),
element->attributeName(QTest::AI_File),
quotedFile.constData(),
element->attributeName(QTest::AI_Line),
element->attributeValue(QTest::AI_Line),
- element->attributeValue(QTest::AI_Tag) ? element->attributeValue(QTest::AI_Tag) : "",
cdataDesc.constData());
break;
}
diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp
index 79bb84c..6c76388 100644
--- a/src/testlib/qtestlogger.cpp
+++ b/src/testlib/qtestlogger.cpp
@@ -318,9 +318,6 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char
break;
}
- const char *tag = QTestResult::currentDataTag();
- if (tag)
- errorElement->addAttribute(QTest::AI_Tag, tag);
errorElement->addAttribute(QTest::AI_Type, typeBuf);
errorElement->addAttribute(QTest::AI_Description, message);
diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp
index 9addb31..b9946e5 100644
--- a/src/testlib/qtestxmlstreamer.cpp
+++ b/src/testlib/qtestxmlstreamer.cpp
@@ -111,13 +111,12 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer
QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
- QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <DataTag>%s</DataTag>\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
+ QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
element->attributeValue(QTest::AI_Type),
element->attributeName(QTest::AI_File),
quotedFile.constData(),
element->attributeName(QTest::AI_Line),
element->attributeValue(QTest::AI_Line),
- element->attributeValue(QTest::AI_Tag) ? element->attributeValue(QTest::AI_Tag) : "",
cdataDesc.constData());
break;
}