summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp133
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p.h7
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp49
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp19
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp36
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle_p_p.h8
-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/parser/qdeclarativejs.g2
-rw-r--r--src/declarative/qml/parser/qdeclarativejsgrammar.cpp6
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp42
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp9
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp106
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h1
-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.cpp44
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp8
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h3
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp9
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp186
-rw-r--r--src/declarative/qml/qdeclarativeengine.h7
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h10
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeerror.cpp63
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.cpp11
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp22
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.h2
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp119
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h19
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h1
-rw-r--r--src/declarative/qml/qdeclarativelist.cpp15
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp8
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp28
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.cpp32
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject.cpp14
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp100
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.cpp33
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp6
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp7
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp27
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject_p.h1
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp15
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp9
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp5
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent.cpp5
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp4
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp4
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow.cpp4
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp16
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp3
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/declarative/util/qdeclarativetimer_p.h1
-rw-r--r--src/declarative/util/qdeclarativeview.cpp272
-rw-r--r--src/declarative/util/qdeclarativeview.h2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h1
-rw-r--r--src/imports/gestures/gestures.pro3
-rw-r--r--src/imports/multimedia/multimedia.pro3
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp10
-rw-r--r--src/imports/multimedia/qdeclarativevideo.cpp16
-rw-r--r--src/imports/particles/particles.pro3
-rw-r--r--src/imports/particles/qdeclarativeparticles.cpp14
-rw-r--r--src/imports/webkit/webkit.pro3
-rw-r--r--src/imports/widgets/widgets.pro3
-rw-r--r--src/multimedia/effects/qsoundeffect.cpp4
-rw-r--r--src/s60installs/s60installs.pro19
97 files changed, 1071 insertions, 784 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index 9d9d1d0..34e73fd 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -60,12 +60,12 @@ class QDeclarativeDebugServer : public QObject
Q_DISABLE_COPY(QDeclarativeDebugServer)
public:
static QDeclarativeDebugServer *instance();
- void wait();
- void registerForStartNotification(QObject *object, const char *receiver);
+ void listen();
+ bool hasDebuggingClient() const;
private Q_SLOTS:
void readyRead();
- void registeredObjectDestroyed(QObject *object);
+ void newConnection();
private:
friend class QDeclarativeDebugService;
@@ -78,14 +78,14 @@ class QDeclarativeDebugServerPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QDeclarativeDebugServer)
public:
QDeclarativeDebugServerPrivate();
- void wait();
int port;
QTcpSocket *connection;
QPacketProtocol *protocol;
QHash<QString, QDeclarativeDebugService *> plugins;
QStringList enabledPlugins;
- QList<QPair<QObject*, QByteArray> > notifyClients;
+ QTcpServer *tcpServer;
+ bool gotHello;
};
class QDeclarativeDebugServicePrivate : public QObjectPrivate
@@ -99,56 +99,41 @@ public:
};
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate()
-: connection(0), protocol(0)
+: connection(0), protocol(0), gotHello(false)
{
}
-void QDeclarativeDebugServerPrivate::wait()
+void QDeclarativeDebugServer::listen()
{
- Q_Q(QDeclarativeDebugServer);
- QTcpServer server;
-
- if (!server.listen(QHostAddress::Any, port)) {
- qWarning("QDeclarativeDebugServer: Unable to listen on port %d", port);
- return;
- }
-
- qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", port);
-
- for (int i=0; i<notifyClients.count(); i++) {
- if (!QMetaObject::invokeMethod(notifyClients[i].first, notifyClients[i].second)) {
- qWarning() << "QDeclarativeDebugServer: unable to call method" << notifyClients[i].second
- << "on object" << notifyClients[i].first << "to notify of debug server start";
- }
- }
- notifyClients.clear();
+ Q_D(QDeclarativeDebugServer);
- if (!server.waitForNewConnection(-1)) {
- qWarning("QDeclarativeDebugServer: Connection error");
- return;
- }
+ d->tcpServer = new QTcpServer(this);
+ QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
+ if (d->tcpServer->listen(QHostAddress::Any, d->port))
+ qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port);
+ else
+ qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port);
+}
- connection = server.nextPendingConnection();
- connection->setParent(q);
- protocol = new QPacketProtocol(connection, q);
+void QDeclarativeDebugServer::newConnection()
+{
+ Q_D(QDeclarativeDebugServer);
- // ### Wait for hello
- while (!protocol->packetsAvailable()) {
- connection->waitForReadyRead();
- }
- QPacket hello = protocol->read();
- QString name;
- hello >> name >> enabledPlugins;
- if (name != QLatin1String("QDeclarativeDebugServer")) {
- qWarning("QDeclarativeDebugServer: Invalid hello message");
- delete protocol; delete connection; connection = 0; protocol = 0;
+ if (d->connection) {
+ qWarning("QDeclarativeDebugServer error: another client is already connected");
return;
}
- QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(readyRead()));
- q->readyRead();
+ d->connection = d->tcpServer->nextPendingConnection();
+ d->connection->setParent(this);
+ d->protocol = new QPacketProtocol(d->connection, this);
+ QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
- qWarning("QDeclarativeDebugServer: Connection established");
+bool QDeclarativeDebugServer::hasDebuggingClient() const
+{
+ Q_D(const QDeclarativeDebugServer);
+ return d->gotHello;
}
QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
@@ -163,36 +148,15 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
bool ok = false;
int port = env.toInt(&ok);
- if (ok && port > 1024)
+ if (ok && port > 1024) {
server = new QDeclarativeDebugServer(port);
+ server->listen();
+ }
}
return server;
}
-void QDeclarativeDebugServer::wait()
-{
- Q_D(QDeclarativeDebugServer);
- d->wait();
-}
-
-void QDeclarativeDebugServer::registerForStartNotification(QObject *object, const char *methodName)
-{
- Q_D(QDeclarativeDebugServer);
- connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*)));
- d->notifyClients.append(qMakePair(object, QByteArray(methodName)));
-}
-
-void QDeclarativeDebugServer::registeredObjectDestroyed(QObject *object)
-{
- Q_D(QDeclarativeDebugServer);
- QMutableListIterator<QPair<QObject*, QByteArray> > i(d->notifyClients);
- while (i.hasNext()) {
- if (i.next().first == object)
- i.remove();
- }
-}
-
QDeclarativeDebugServer::QDeclarativeDebugServer(int port)
: QObject(*(new QDeclarativeDebugServerPrivate))
{
@@ -204,6 +168,23 @@ void QDeclarativeDebugServer::readyRead()
{
Q_D(QDeclarativeDebugServer);
+ if (!d->gotHello) {
+ QPacket hello = d->protocol->read();
+ QString name;
+ hello >> name >> d->enabledPlugins;
+ if (name != QLatin1String("QDeclarativeDebugServer")) {
+ qWarning("QDeclarativeDebugServer: Invalid hello message");
+ QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ d->protocol->deleteLater();
+ d->protocol = 0;
+ d->connection->deleteLater();
+ d->connection = 0;
+ return;
+ }
+ d->gotHello = true;
+ qWarning("QDeclarativeDebugServer: Connection established");
+ }
+
QString debugServer(QLatin1String("QDeclarativeDebugServer"));
while (d->protocol->packetsAvailable()) {
@@ -375,6 +356,12 @@ bool QDeclarativeDebugService::isDebuggingEnabled()
return QDeclarativeDebugServer::instance() != 0;
}
+bool QDeclarativeDebugService::hasDebuggingClient()
+{
+ return QDeclarativeDebugServer::instance() != 0
+ && QDeclarativeDebugServer::instance()->hasDebuggingClient();
+}
+
QString QDeclarativeDebugService::objectToString(QObject *obj)
{
if(!obj)
@@ -390,16 +377,6 @@ QString QDeclarativeDebugService::objectToString(QObject *obj)
return rv;
}
-void QDeclarativeDebugService::waitForClients()
-{
- QDeclarativeDebugServer::instance()->wait();
-}
-
-void QDeclarativeDebugService::notifyOnServerStart(QObject *object, const char *receiver)
-{
- QDeclarativeDebugServer::instance()->registerForStartNotification(object, receiver);
-}
-
void QDeclarativeDebugService::sendMessage(const QByteArray &message)
{
Q_D(QDeclarativeDebugService);
diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h
index 498edf3..c461ddf 100644
--- a/src/declarative/debugger/qdeclarativedebugservice_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p.h
@@ -68,19 +68,16 @@ public:
static int idForObject(QObject *);
static QObject *objectForId(int);
- static bool isDebuggingEnabled();
static QString objectToString(QObject *obj);
- static void waitForClients();
-
- static void notifyOnServerStart(QObject *object, const char *receiver);
+ static bool isDebuggingEnabled();
+ static bool hasDebuggingClient();
protected:
virtual void enabledChanged(bool);
virtual void messageReceived(const QByteArray &);
private:
- void registerForStartNotification(QObject *object, const char *methodName);
friend class QDeclarativeDebugServer;
};
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 be9d8bd..06f8363 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -82,7 +82,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
QDeclarativePixmapCache::cancel(d->sciurl, this);
}
/*!
- \qmlproperty enum BorderImage::status
+ \qmlproperty enumeration BorderImage::status
This property holds the status of image loading. It can be one of:
\list
@@ -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/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index a181071..4425c97 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -145,7 +145,7 @@ Item {
*/
/*!
- \qmlproperty enum MouseEvent::button
+ \qmlproperty enumeration MouseEvent::button
This property holds the button that caused the event. It can be one of:
\list
diff --git a/src/declarative/graphicsitems/qdeclarativeevents_p_p.h b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
index 65ac8de..0e0329e 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
@@ -115,6 +115,10 @@ public:
bool wasHeld() const { return _wasHeld; }
bool isClick() const { return _isClick; }
+ // only for internal usage
+ void setX(int x) { _x = x; }
+ void setY(int y) { _y = y; }
+
bool isAccepted() { return _accepted; }
void setAccepted(bool accepted) { _accepted = accepted; }
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 951b171..a76d88e 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -248,18 +248,12 @@ void QDeclarativeFlickablePrivate::fixupX_callback(void *data)
void QDeclarativeFlickablePrivate::fixupX()
{
Q_Q(QDeclarativeFlickable);
- if (!q->xflick() || hData.move.timeLine())
- return;
-
fixup(hData, q->minXExtent(), q->maxXExtent());
}
void QDeclarativeFlickablePrivate::fixupY()
{
Q_Q(QDeclarativeFlickable);
- if (!q->yflick() || vData.move.timeLine())
- return;
-
fixup(vData, q->minYExtent(), q->maxYExtent());
}
@@ -272,7 +266,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
if (fixupDuration) {
qreal dist = minExtent - data.move;
timeline.move(data.move, minExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
- timeline.move(data.move, minExtent, QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ timeline.move(data.move, minExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4);
} else {
data.move.setValue(minExtent);
q->viewportMoved();
@@ -284,7 +278,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
if (fixupDuration) {
qreal dist = maxExtent - data.move;
timeline.move(data.move, maxExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
- timeline.move(data.move, maxExtent, QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ timeline.move(data.move, maxExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4);
} else {
data.move.setValue(maxExtent);
q->viewportMoved();
@@ -1059,8 +1053,12 @@ void QDeclarativeFlickable::setContentWidth(qreal w)
else
d->viewport->setWidth(w);
// Make sure that we're entirely in view.
- if (!d->pressed)
+ if (!d->pressed) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
d->fixupX();
+ d->fixupDuration = oldDuration;
+ }
emit contentWidthChanged();
d->updateBeginningEnd();
}
@@ -1082,8 +1080,12 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
else
d->viewport->setHeight(h);
// Make sure that we're entirely in view.
- if (!d->pressed)
+ if (!d->pressed) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
d->fixupY();
+ d->fixupDuration = oldDuration;
+ }
emit contentHeightChanged();
d->updateBeginningEnd();
}
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 98e34a9..57045f1 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -57,10 +57,14 @@ public:
QDeclarativeFlipablePrivate() : current(QDeclarativeFlipable::Front), front(0), back(0) {}
void updateSceneTransformFromParent();
+ void setBackTransform();
QDeclarativeFlipable::Side current;
QDeclarativeGuard<QGraphicsObject> front;
QDeclarativeGuard<QGraphicsObject> back;
+
+ bool wantBackXFlipped;
+ bool wantBackYFlipped;
};
/*!
@@ -148,6 +152,17 @@ void QDeclarativeFlipable::setBack(QGraphicsObject *back)
d->back->setParentItem(this);
if (Front == d->current)
d->back->setOpacity(0.);
+ connect(back, SIGNAL(widthChanged()),
+ this, SLOT(retransformBack()));
+ connect(back, SIGNAL(heightChanged()),
+ this, SLOT(retransformBack()));
+}
+
+void QDeclarativeFlipable::retransformBack()
+{
+ Q_D(QDeclarativeFlipable);
+ if (d->current == QDeclarativeFlipable::Back && d->back)
+ d->setBackTransform();
}
/*!
@@ -184,26 +199,20 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
(p1.y() - p2.y()) * (p3.x() - p2.x());
+ wantBackYFlipped = p1.x() >= p2.x();
+ wantBackXFlipped = p2.y() >= p3.y();
+
QDeclarativeFlipable::Side newSide;
if (cross > 0) {
- newSide = QDeclarativeFlipable::Back;
+ newSide = QDeclarativeFlipable::Back;
} else {
newSide = QDeclarativeFlipable::Front;
}
if (newSide != current) {
current = newSide;
- if (current == QDeclarativeFlipable::Back && back) {
- QTransform mat;
- QGraphicsItemPrivate *dBack = QGraphicsItemPrivate::get(back);
- mat.translate(dBack->width()/2,dBack->height()/2);
- if (dBack->width() && p1.x() >= p2.x())
- mat.rotate(180, Qt::YAxis);
- if (dBack->height() && p2.y() >= p3.y())
- mat.rotate(180, Qt::XAxis);
- mat.translate(-dBack->width()/2,-dBack->height()/2);
- back->setTransform(mat);
- }
+ if (current == QDeclarativeFlipable::Back && back)
+ setBackTransform();
if (front)
front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.);
if (back)
@@ -212,4 +221,20 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
}
}
+/* Depends on the width/height of the back item, and so needs reevaulating
+ if those change.
+*/
+void QDeclarativeFlipablePrivate::setBackTransform()
+{
+ QTransform mat;
+ QGraphicsItemPrivate *dBack = QGraphicsItemPrivate::get(back);
+ mat.translate(dBack->width()/2,dBack->height()/2);
+ if (dBack->width() && wantBackYFlipped)
+ mat.rotate(180, Qt::YAxis);
+ if (dBack->height() && wantBackXFlipped)
+ mat.rotate(180, Qt::XAxis);
+ mat.translate(-dBack->width()/2,-dBack->height()/2);
+ back->setTransform(mat);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
index 302f083..fd0119b 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
@@ -81,6 +81,9 @@ public:
Q_SIGNALS:
void sideChanged();
+private Q_SLOTS:
+ void retransformBack();
+
private:
Q_DISABLE_COPY(QDeclarativeFlipable)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeFlipable)
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 562ba2a..23140fa 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -50,6 +50,7 @@
#include <qlistmodelinterface_p.h>
#include <QKeyEvent>
+#include <qmath.h>
#include <math.h>
QT_BEGIN_NAMESPACE
@@ -746,12 +747,6 @@ void QDeclarativeGridViewPrivate::fixupPosition()
void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent)
{
Q_Q(QDeclarativeGridView);
-
- if ((&data == &vData && !q->yflick())
- || (&data == &hData && !q->xflick())
- || data.move.timeLine())
- return;
-
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
@@ -840,7 +835,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (v > 0)
dist = -dist;
data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart;
- dist = -data.flickTarget + data.move.value();
+ qreal adjDist = -data.flickTarget + data.move.value();
+ if (qAbs(adjDist) > qAbs(dist)) {
+ // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
+ v2 = accel * 2.0f * qAbs(dist);
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
+ dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
} else {
data.flickTarget = velocity > 0 ? minExtent : maxExtent;
@@ -885,7 +888,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
In this case ListModel is a handy way for us to test our UI. In practice
the model would be implemented in C++, or perhaps via a SQL data source.
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index ca86637..247e348 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -221,7 +221,7 @@ qreal QDeclarativeImage::paintedHeight() const
}
/*!
- \qmlproperty enum Image::status
+ \qmlproperty enumeration Image::status
This property holds the status of image loading. It can be one of:
\list
@@ -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 86dbaf0..37c7923 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1415,7 +1415,7 @@ QDeclarativeItem::~QDeclarativeItem()
}
/*!
- \qmlproperty enum Item::transformOrigin
+ \qmlproperty enumeration Item::transformOrigin
This property holds the origin point around which scale and rotation transform.
Nine transform origins are available, as shown in the image below.
@@ -1794,9 +1794,13 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry,
if (transformOrigin() != QDeclarativeItem::TopLeft
&& (newGeometry.width() != oldGeometry.width() || newGeometry.height() != oldGeometry.height())) {
- QPointF origin = d->computeTransformOrigin();
- if (transformOriginPoint() != origin)
- setTransformOriginPoint(origin);
+ if (d->transformData) {
+ QPointF origin = d->computeTransformOrigin();
+ if (transformOriginPoint() != origin)
+ setTransformOriginPoint(origin);
+ } else {
+ d->transformOriginDirty = true;
+ }
}
if (newGeometry.x() != oldGeometry.x())
@@ -2238,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;
}
@@ -2264,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;
}
@@ -2656,11 +2660,23 @@ void QDeclarativeItem::setTransformOrigin(TransformOrigin origin)
Q_D(QDeclarativeItem);
if (origin != d->origin) {
d->origin = origin;
- QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin());
+ if (d->transformData)
+ QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin());
+ else
+ d->transformOriginDirty = true;
emit transformOriginChanged(d->origin);
}
}
+void QDeclarativeItemPrivate::transformChanged()
+{
+ Q_Q(QDeclarativeItem);
+ if (transformOriginDirty) {
+ q->QGraphicsItem::setTransformOriginPoint(computeTransformOrigin());
+ transformOriginDirty = false;
+ }
+}
+
/*!
\property QDeclarativeItem::smooth
\brief whether the item is smoothly transformed.
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index cf138c3..3f5bf1a 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -116,7 +116,7 @@ public:
_stateGroup(0), origin(QDeclarativeItem::Center),
widthValid(false), heightValid(false),
_componentComplete(true), _keepMouse(false),
- smooth(false), keyHandler(0),
+ smooth(false), transformOriginDirty(true), keyHandler(0),
mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
@@ -233,6 +233,7 @@ public:
bool _componentComplete:1;
bool _keepMouse:1;
bool smooth:1;
+ bool transformOriginDirty : 1;
QDeclarativeItemKeyFilter *keyHandler;
@@ -269,6 +270,9 @@ public:
}
}
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void transformChanged();
+
virtual void focusChanged(bool);
static int consistentTime;
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 307c0a7..672f723 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -50,6 +50,7 @@
#include <qdeclarativeguard_p.h>
#include <qlistmodelinterface_p.h>
+#include <qmath.h>
#include <QKeyEvent>
QT_BEGIN_NAMESPACE
@@ -1101,11 +1102,6 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
|| (orient == QDeclarativeListView::Vertical && &data == &hData))
return;
- if ((&data == &vData && !q->yflick())
- || (&data == &hData && !q->xflick())
- || data.move.timeLine())
- return;
-
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
@@ -1211,7 +1207,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
data.flickTarget -= overshootDist;
}
}
- dist = -data.flickTarget + data.move.value();
+ qreal adjDist = -data.flickTarget + data.move.value();
+ if (qAbs(adjDist) > qAbs(dist)) {
+ // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
+ v2 = accel * 2.0f * qAbs(dist);
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
+ dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
} else if (overShoot) {
data.flickTarget = data.move.value() - dist;
@@ -1286,7 +1290,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
In this case ListModel is a handy way for us to test our UI. In practice
the model would be implemented in C++, or perhaps via a SQL data source.
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 409c228..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();
@@ -325,7 +325,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
}
/*!
- \qmlproperty enum Loader::status
+ \qmlproperty enumeration Loader::status
This property holds the status of QML loading. It can be one of:
\list
@@ -383,7 +383,7 @@ qreal QDeclarativeLoader::progress() const
}
/*!
- \qmlproperty enum Loader::resizeMode
+ \qmlproperty enumeration Loader::resizeMode
This property determines how the Loader or item are resized:
\list
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index a6cc75e..bdb4868 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -466,6 +466,9 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
d->moved = true;
}
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ emit mousePositionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
emit positionChanged(&me);
}
@@ -518,6 +521,9 @@ void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} else {
d->lastPos = event->pos();
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ emit mousePositionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
emit positionChanged(&me);
}
}
@@ -561,6 +567,18 @@ void QDeclarativeMouseArea::timerEvent(QTimerEvent *event)
}
}
+void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry)
+{
+ Q_D(QDeclarativeMouseArea);
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+
+ if (d->lastScenePos.isNull)
+ d->lastScenePos = mapToScene(d->lastPos);
+ else if (newGeometry.x() != oldGeometry.x() || newGeometry.y() != oldGeometry.y())
+ d->lastPos = mapFromScene(d->lastScenePos);
+}
+
/*!
\qmlproperty bool MouseArea::hoverEnabled
This property holds whether hover events are handled.
@@ -648,9 +666,13 @@ bool QDeclarativeMouseArea::setPressed(bool p)
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
if (d->pressed) {
emit pressed(&me);
- emit positionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
+ emit mousePositionChanged(&me);
} else {
emit released(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
if (isclick && !d->longPress)
emit clicked(&me);
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 58faac1..630840f 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -108,8 +108,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
{
Q_OBJECT
- Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged)
- Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mousePositionChanged)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mousePositionChanged)
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
@@ -144,6 +144,7 @@ Q_SIGNALS:
void enabledChanged();
void acceptedButtonsChanged();
void positionChanged(QDeclarativeMouseEvent *mouse);
+ void mousePositionChanged(QDeclarativeMouseEvent *mouse);
void pressed(QDeclarativeMouseEvent *mouse);
void pressAndHold(QDeclarativeMouseEvent *mouse);
@@ -167,6 +168,9 @@ protected:
bool sceneEvent(QEvent *);
void timerEvent(QTimerEvent *event);
+ virtual void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry);
+
private:
void handlePress();
void handleRelease();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
index 9068c7c..4973957 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
@@ -81,6 +81,7 @@ public:
void saveEvent(QGraphicsSceneMouseEvent *event) {
lastPos = event->pos();
+ lastScenePos = event->scenePos();
lastButton = event->button();
lastButtons = event->buttons();
lastModifiers = event->modifiers();
@@ -105,6 +106,7 @@ public:
qreal startX;
qreal startY;
QPointF lastPos;
+ QDeclarativeNullableValue<QPointF> lastScenePos;
Qt::MouseButton lastButton;
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 4aaa28d..d0a3cd1 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -314,7 +314,7 @@ void QDeclarativePathViewPrivate::regenerate()
\image pathview.gif
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index 24b65fa..b5fc979 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -136,7 +136,7 @@ private:
class Q_DECLARATIVE_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner
{
Q_OBJECT
- Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowChanged)
+ Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 54c8ab2..3daa83f 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -172,6 +172,8 @@ void QDeclarativeGradient::doUpdate()
\image declarative-rect.png
*/
+int QDeclarativeRectanglePrivate::doUpdateSlotIdx = -1;
+
/*!
\internal
\class QDeclarativeRectangle
@@ -252,11 +254,16 @@ void QDeclarativeRectangle::setGradient(QDeclarativeGradient *gradient)
Q_D(QDeclarativeRectangle);
if (d->gradient == gradient)
return;
+ static int updatedSignalIdx = -1;
+ if (updatedSignalIdx < 0)
+ updatedSignalIdx = QDeclarativeGradient::staticMetaObject.indexOfSignal("updated()");
+ if (d->doUpdateSlotIdx < 0)
+ d->doUpdateSlotIdx = QDeclarativeRectangle::staticMetaObject.indexOfSlot("doUpdate()");
if (d->gradient)
- disconnect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate()));
+ QMetaObject::disconnect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx);
d->gradient = gradient;
if (d->gradient)
- connect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate()));
+ QMetaObject::connect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx);
update();
}
@@ -350,7 +357,9 @@ void QDeclarativeRectangle::generateBorderedRect()
Q_D(QDeclarativeRectangle);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
+ // Adding 5 here makes qDrawBorderPixmap() paint correctly with smooth: true
+ // Ideally qDrawBorderPixmap() would be fixed - QTBUG-7999
+ d->rectImage = QPixmap(pw*2 + 5, pw*2 + 5);
d->rectImage.fill(Qt::transparent);
QPainter p(&(d->rectImage));
p.setRenderHint(QPainter::Antialiasing);
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
index 84418bc..001b018 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
@@ -81,12 +81,18 @@ public:
qreal radius;
qreal paintmargin;
QPixmap rectImage;
+ static int doUpdateSlotIdx;
QDeclarativePen *getPen() {
if (!pen) {
Q_Q(QDeclarativeRectangle);
pen = new QDeclarativePen;
- QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate()));
+ static int penChangedSignalIdx = -1;
+ if (penChangedSignalIdx < 0)
+ penChangedSignalIdx = QDeclarativePen::staticMetaObject.indexOfSignal("penChanged()");
+ if (doUpdateSlotIdx < 0)
+ doUpdateSlotIdx = QDeclarativeRectangle::staticMetaObject.indexOfSlot("doUpdate()");
+ QMetaObject::connect(pen, penChangedSignalIdx, q, doUpdateSlotIdx);
}
return pen;
}
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/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g
index ba9338e..1b66ba0 100644
--- a/src/declarative/qml/parser/qdeclarativejs.g
+++ b/src/declarative/qml/parser/qdeclarativejs.g
@@ -1376,7 +1376,7 @@ case $rule_number: {
} break;
./
-PropertyName: T_IDENTIFIER %prec REDUCE_HERE ;
+PropertyName: T_IDENTIFIER %prec SHIFT_THERE ;
/.
case $rule_number: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
index 52e979a..b87d8f4 100644
--- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
// This file was generated by qlalr - DO NOT EDIT!
-#include "private/qdeclarativejsgrammar_p.h"
+#include "qdeclarativejsgrammar_p.h"
QT_BEGIN_NAMESPACE
@@ -346,9 +346,9 @@ const short QDeclarativeJSGrammar::action_index [] = {
const short QDeclarativeJSGrammar::action_info [] = {
399, 352, 345, -101, 343, 457, 440, 403, 257, -112,
- -125, -131, -123, -98, -120, 348, -128, 389, 453, 391,
+ -125, -131, -123, 346, -120, 348, -128, 389, 453, 391,
416, 401, 408, 563, -101, -123, 416, -120, 539, -131,
- -98, -112, -125, 348, 257, 99, 71, 645, 621, 101,
+ 346, -112, -125, 348, 257, 99, 71, 645, 621, 101,
-128, 440, 141, 621, 164, 431, 539, 430, 453, 573,
457, 444, 440, 424, 71, 424, 101, 446, 559, 420,
424, 448, 539, 440, 570, 539, 466, 527, 312, 346,
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 3a0e897..a686dca 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -484,6 +484,8 @@ int Lexer::lex()
stackToken = -1;
}
+ bool identifierWithEscapedUnicode = false;
+
while (!done) {
switch (state) {
case Start:
@@ -523,7 +525,26 @@ int Lexer::lex()
state = InString;
multiLineString = false;
stringType = current;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ recordStartPos();
+
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ state = InIdentifier;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
+
} else if (isIdentLetter(current)) {
+ identifierWithEscapedUnicode = false;
recordStartPos();
record16(current);
state = InIdentifier;
@@ -683,6 +704,21 @@ int Lexer::lex()
if (isIdentLetter(current) || isDecimalDigit(current)) {
record16(current);
break;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ break;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
}
setDone(Identifier);
break;
@@ -825,7 +861,11 @@ int Lexer::lex()
delimited = true;
return token;
case Identifier:
- if ((token = findReservedWord(buffer16, pos16)) < 0) {
+ token = -1;
+ if (! identifierWithEscapedUnicode)
+ token = findReservedWord(buffer16, pos16);
+
+ if (token < 0) {
/* TODO: close leak on parse error. same holds true for String */
if (driver)
qsyylval.ustr = driver->intern(buffer16, pos16);
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..6596aba 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -888,13 +888,6 @@ void QDeclarativeCompiledBindingsPrivate::findgeneric(Register *output,
return;
}
- for (int ii = 0; ii < context->scripts.count(); ++ii) {
- QScriptValue function = QScriptDeclarativeClass::function(context->scripts.at(ii), name);
- if (function.isValid()) {
- qFatal("Binding optimizer resolved name to QScript method");
- }
- }
-
if (QObject *root = context->contextObject) {
if (findproperty(root, output, enginePriv, subIdx, name, isTerminal))
@@ -938,7 +931,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..2614764 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -733,10 +733,6 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
return true;
}
- // Build any script blocks for this type
- for (int ii = 0; ii < obj->scriptBlockObjects.count(); ++ii)
- COMPILE_CHECK(buildScript(obj, obj->scriptBlockObjects.at(ii)));
-
// Object instantiations reset the binding context
BindingContext objCtxt(obj);
@@ -961,17 +957,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
output->bytecode << id;
}
- // Set any script blocks
- for (int ii = 0; ii < obj->scripts.count(); ++ii) {
- QDeclarativeInstruction script;
- script.type = QDeclarativeInstruction::StoreScript;
- script.line = 0; // ###
- int idx = output->scripts.count();
- output->scripts << obj->scripts.at(ii);
- script.storeScript.value = idx;
- output->bytecode << script;
- }
-
// Begin the class
if (obj->parserStatusCast != -1) {
QDeclarativeInstruction begin;
@@ -1177,9 +1162,6 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
COMPILE_EXCEPTION(*obj->properties.begin(), tr("Component elements may not contain properties other than id"));
- if (!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), tr("Component elements may not contain script blocks"));
-
if (obj->properties.count())
idProp = *obj->properties.begin();
@@ -1216,94 +1198,6 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
return true;
}
-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.";
-
- Object::ScriptBlock scriptBlock;
-
- if (script->properties.count() == 1 &&
- script->properties.begin().key() == QByteArray("source")) {
-
- Property *source = *script->properties.begin();
- if (script->defaultProperty)
- COMPILE_EXCEPTION(source, tr("Invalid Script block. Specify either the source property or inline script"));
-
- if (source->value || source->values.count() != 1 ||
- source->values.at(0)->object || !source->values.at(0)->value.isStringList())
- COMPILE_EXCEPTION(source, tr("Invalid Script source value"));
-
- QStringList sources = source->values.at(0)->value.asStringList();
-
- for (int jj = 0; jj < sources.count(); ++jj) {
- QString sourceUrl = output->url.resolved(QUrl(sources.at(jj))).toString();
- QString scriptCode;
- int lineNumber = 1;
-
- for (int ii = 0; ii < unit->resources.count(); ++ii) {
- if (unit->resources.at(ii)->url == sourceUrl) {
- scriptCode = QString::fromUtf8(unit->resources.at(ii)->data);
- break;
- }
- }
-
- if (!scriptCode.isEmpty()) {
- scriptBlock.codes.append(scriptCode);
- scriptBlock.files.append(sourceUrl);
- scriptBlock.lineNumbers.append(lineNumber);
- scriptBlock.pragmas.append(Object::ScriptBlock::None);
- }
- }
-
- } else if (!script->properties.isEmpty()) {
- COMPILE_EXCEPTION(*script->properties.begin(), tr("Properties cannot be set on Script block"));
- } else if (script->defaultProperty) {
-
- QString scriptCode;
- int lineNumber = 1;
- QString sourceUrl = output->url.toString();
-
- QDeclarativeParser::Location currentLocation;
-
- for (int ii = 0; ii < script->defaultProperty->values.count(); ++ii) {
- Value *v = script->defaultProperty->values.at(ii);
- if (lineNumber == 1)
- lineNumber = v->location.start.line;
- if (v->object || !v->value.isString())
- COMPILE_EXCEPTION(v, tr("Invalid Script block"));
-
- if (ii == 0) {
- currentLocation = v->location.start;
- scriptCode.append(QString(currentLocation.column, QLatin1Char(' ')));
- }
-
- while (currentLocation.line < v->location.start.line) {
- scriptCode.append(QLatin1Char('\n'));
- currentLocation.line++;
- currentLocation.column = 0;
- }
-
- scriptCode.append(QString(v->location.start.column - currentLocation.column, QLatin1Char(' ')));
-
- scriptCode += v->value.asString();
- currentLocation = v->location.end;
- currentLocation.column++;
- }
-
- if (!scriptCode.isEmpty()) {
- scriptBlock.codes.append(scriptCode);
- scriptBlock.files.append(sourceUrl);
- scriptBlock.lineNumbers.append(lineNumber);
- scriptBlock.pragmas.append(Object::ScriptBlock::None);
- }
- }
-
- if (!scriptBlock.codes.isEmpty())
- obj->scripts << scriptBlock;
-
- return true;
-}
-
bool QDeclarativeCompiler::buildComponentFromRoot(QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 867db2c..cdc514d 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -186,7 +186,6 @@ private:
bool buildObject(QDeclarativeParser::Object *obj, const BindingContext &);
- bool buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script);
bool buildComponent(QDeclarativeParser::Object *obj, const BindingContext &);
bool buildSubObject(QDeclarativeParser::Object *obj, const BindingContext &);
bool buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
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 6657fea..2041e0a 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -114,7 +114,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
\endcode
All properties added explicitly by QDeclarativeContext::setContextProperty() take
- precedence over context object's properties.
+ precedence over the context object's properties.
Contexts form a hierarchy. The root of this heirarchy is the QDeclarativeEngine's
\l {QDeclarativeEngine::rootContext()}{root context}. A component instance can
@@ -140,6 +140,11 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
While QML objects instantiated in a context are not strictly owned by that
context, their bindings are. If a context is destroyed, the property bindings of
outstanding QML objects will stop evaluating.
+
+ \note Setting the context object or adding new context properties after an object
+ has been created in that context is an expensive operation (essentially forcing all bindings
+ to reevaluate). Thus whenever possible you should complete "setup" of the context
+ before using it to create any objects.
*/
/*! \internal */
@@ -655,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();
@@ -681,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();
@@ -691,39 +696,6 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
}
}
-void QDeclarativeContextData::addScript(const QDeclarativeParser::Object::ScriptBlock &script,
- QObject *scopeObject)
-{
- if (!engine)
- return;
-
- QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
- QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
-
- QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
-
- scriptContext->pushScope(enginePriv->contextClass->newContext(this, scopeObject));
- scriptContext->pushScope(enginePriv->globalClass->globalObject());
-
- QScriptValue scope = scriptEngine->newObject();
- scriptContext->setActivationObject(scope);
- scriptContext->pushScope(scope);
-
- for (int ii = 0; ii < script.codes.count(); ++ii) {
- scriptEngine->evaluate(script.codes.at(ii), script.files.at(ii), script.lineNumbers.at(ii));
-
- if (scriptEngine->hasUncaughtException()) {
- QDeclarativeError error;
- QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
- }
- }
-
- scriptEngine->popContext();
-
- scripts.append(scope);
-}
-
void QDeclarativeContextData::setIdProperty(int idx, QObject *obj)
{
idValues[idx] = obj;
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index 77a6d94..c7fb099 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -145,10 +145,8 @@ public:
QObject *contextObject;
// Any script blocks that exist on this context
- QList<QScriptValue> scripts;
QList<QScriptValue> importedScripts;
void addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script);
- void addScript(const QDeclarativeParser::Object::ScriptBlock &script, QObject *scopeObject);
// Context base url
QUrl url;
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index 461fab5..1336a1a 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -189,14 +189,6 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte
}
}
- for (int ii = 0; ii < bindContext->scripts.count(); ++ii) {
- lastFunction = QScriptDeclarativeClass::function(bindContext->scripts.at(ii), name);
- if (lastFunction.isValid()) {
- lastContext = bindContext;
- return QScriptClass::HandlesReadAccess;
- }
- }
-
if (scopeObject) {
QScriptClass::QueryFlags rv =
ep->objectClass->queryProperty(scopeObject, name, flags, bindContext,
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 96145fb..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);
@@ -390,8 +388,6 @@ void QDeclarativeEnginePrivate::init()
qmlEngineDebugServer();
isDebugging = true;
QDeclarativeEngineDebugServer::addEngine(q);
-
- qmlEngineDebugServer()->waitForClients();
}
}
@@ -652,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;
}
/*!
@@ -779,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);
}
}
@@ -957,7 +980,7 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
}else{
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
@@ -977,7 +1000,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 or 3 parameters"));
QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
@@ -997,35 +1020,30 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
if(!parentArg)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("parent object not found"));
QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
if(component.isError()) {
QList<QDeclarativeError> errors = component.errors();
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ QString errstr = QLatin1String("Qt.createQmlObject(): ");
foreach (const QDeclarativeError &error, errors)
- qWarning().nospace() << " " << error;
-
- return engine->nullValue();
+ errstr += QLatin1String(" ") + error.toString() + QLatin1String("\n");
+ return ctxt->throwError(errstr);
}
- if (!component.isReady()) {
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject(): Component is not ready";
-
- return engine->nullValue();
- }
+ if (!component.isReady())
+ return ctxt->throwError(QDeclarativeEngine::tr("Qt.createQmlObject(): component is not ready"));
QObject *obj = component.create(context->asQDeclarativeContext());
if(component.isError()) {
QList<QDeclarativeError> errors = component.errors();
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ QString errstr = QLatin1String("Qt.createQmlObject(): ");
foreach (const QDeclarativeError &error, errors)
- qWarning().nospace() << " " << error;
-
- return engine->nullValue();
+ errstr += QLatin1String(" ") + error.toString() + QLatin1String("\n");
+ return ctxt->throwError(errstr);
}
Q_ASSERT(obj);
@@ -1051,7 +1069,7 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript
QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
@@ -1062,7 +1080,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QDate date = ctxt->argument(0).toDateTime().date();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1073,7 +1091,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid date format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1082,7 +1100,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QTime date = ctxt->argument(0).toDateTime().time();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1093,7 +1111,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid time format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1102,7 +1120,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QDateTime date = ctxt->argument(0).toDateTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1113,7 +1131,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid datetiem format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1122,14 +1140,20 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
- if (r < 0 || r > 1 || g < 0 || g > 1 || b < 0 || b > 1 || a < 0 || a > 1)
- return engine->nullValue();
+ if (r < 0.0) r=0.0;
+ if (r > 1.0) r=1.0;
+ if (g < 0.0) g=0.0;
+ if (g > 1.0) g=1.0;
+ if (b < 0.0) b=0.0;
+ if (b > 1.0) b=1.0;
+ if (a < 0.0) a=0.0;
+ if (a > 1.0) a=1.0;
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a)));
}
@@ -1138,14 +1162,20 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
- if (h < 0 || h > 1 || s < 0 || s > 1 || l < 0 || l > 1 || a < 0 || a > 1)
- return engine->nullValue();
+ if (h < 0.0) h=0.0;
+ if (h > 1.0) h=1.0;
+ if (s < 0.0) s=0.0;
+ if (s > 1.0) s=1.0;
+ if (l < 0.0) l=0.0;
+ if (l > 1.0) l=1.0;
+ if (a < 0.0) a=0.0;
+ if (a > 1.0) a=1.0;
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a)));
}
@@ -1153,7 +1183,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 4 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -1169,7 +1199,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y)));
@@ -1178,7 +1208,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin
QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h)));
@@ -1187,7 +1217,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1206,7 +1236,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1284,23 +1314,82 @@ QScriptValue QDeclarativeEnginePrivate::consoleLog(QScriptContext *ctxt, QScript
return e->newVariant(QVariant(true));
}
-void QDeclarativeEnginePrivate::sendQuit ()
+void QDeclarativeEnginePrivate::sendQuit()
{
Q_Q(QDeclarativeEngine);
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);
- qe->sendQuit ();
+ qe->sendQuit();
return QScriptValue();
}
QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
@@ -1410,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 b3bba43..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;
@@ -311,7 +313,13 @@ public:
QScriptValue scriptValueFromVariant(const QVariant &);
QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid);
- void sendQuit ();
+ 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 7e8aac0..8717f56 100644
--- a/src/declarative/qml/qdeclarativeerror.cpp
+++ b/src/declarative/qml/qdeclarativeerror.cpp
@@ -49,8 +49,27 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeError
- \since 4.7
- \brief The QDeclarativeError class encapsulates a QML error
+ \since 4.7
+ \brief The QDeclarativeError class encapsulates a QML error.
+
+ QDeclarativeError includes a textual description of the error, as well
+ as location information (the file, line, and column). The toString()
+ method creates a single-line, human-readable string containing all of
+ this information, for example:
+ \code
+ file:///home/user/test.qml:7:8: Invalid property assignment: double expected
+ \endcode
+
+ You can use qDebug() or qWarning() to output errors to the console. This method
+ will attempt to open the file indicated by the error
+ and include additional contextual information.
+ \code
+ file:///home/user/test.qml:7:8: Invalid property assignment: double expected
+ y: "hello"
+ ^
+ \endcode
+
+ \sa QDeclarativeView::errors(), QDeclarativeComponent::errors()
*/
class QDeclarativeErrorPrivate
{
@@ -69,7 +88,7 @@ QDeclarativeErrorPrivate::QDeclarativeErrorPrivate()
}
/*!
- Create an empty error object.
+ Creates an empty error object.
*/
QDeclarativeError::QDeclarativeError()
: d(0)
@@ -77,7 +96,7 @@ QDeclarativeError::QDeclarativeError()
}
/*!
- Create a copy of \a other.
+ Creates a copy of \a other.
*/
QDeclarativeError::QDeclarativeError(const QDeclarativeError &other)
: d(0)
@@ -86,7 +105,7 @@ QDeclarativeError::QDeclarativeError(const QDeclarativeError &other)
}
/*!
- Assign \a other to this error object.
+ Assigns \a other to this error object.
*/
QDeclarativeError &QDeclarativeError::operator=(const QDeclarativeError &other)
{
@@ -112,7 +131,7 @@ QDeclarativeError::~QDeclarativeError()
}
/*!
- Return true if this error is valid, otherwise false.
+ Returns true if this error is valid, otherwise false.
*/
bool QDeclarativeError::isValid() const
{
@@ -120,7 +139,7 @@ bool QDeclarativeError::isValid() const
}
/*!
- Return the url for the file that caused this error.
+ Returns the url for the file that caused this error.
*/
QUrl QDeclarativeError::url() const
{
@@ -129,7 +148,7 @@ QUrl QDeclarativeError::url() const
}
/*!
- Set the \a url for the file that caused this error.
+ Sets the \a url for the file that caused this error.
*/
void QDeclarativeError::setUrl(const QUrl &url)
{
@@ -138,7 +157,7 @@ void QDeclarativeError::setUrl(const QUrl &url)
}
/*!
- Return the error description.
+ Returns the error description.
*/
QString QDeclarativeError::description() const
{
@@ -147,7 +166,7 @@ QString QDeclarativeError::description() const
}
/*!
- Set the error \a description.
+ Sets the error \a description.
*/
void QDeclarativeError::setDescription(const QString &description)
{
@@ -156,7 +175,7 @@ void QDeclarativeError::setDescription(const QString &description)
}
/*!
- Return the error line number.
+ Returns the error line number.
*/
int QDeclarativeError::line() const
{
@@ -165,7 +184,7 @@ int QDeclarativeError::line() const
}
/*!
- Set the error \a line number.
+ Sets the error \a line number.
*/
void QDeclarativeError::setLine(int line)
{
@@ -174,7 +193,7 @@ void QDeclarativeError::setLine(int line)
}
/*!
- Return the error column number.
+ Returns the error column number.
*/
int QDeclarativeError::column() const
{
@@ -183,7 +202,7 @@ int QDeclarativeError::column() const
}
/*!
- Set the error \a column number.
+ Sets the error \a column number.
*/
void QDeclarativeError::setColumn(int column)
{
@@ -192,14 +211,20 @@ void QDeclarativeError::setColumn(int column)
}
/*!
- Return the error as a human readable string.
+ Returns the error as a human readable string.
*/
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();
@@ -210,7 +235,7 @@ QString QDeclarativeError::toString() const
\relates QDeclarativeError
\fn QDebug operator<<(QDebug debug, const QDeclarativeError &error)
- Output a human readable version of \a error to \a debug.
+ Outputs a human readable version of \a error to \a debug.
*/
QDebug operator<<(QDebug debug, const QDeclarativeError &error)
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/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp
index 762c642d..863bfc4 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.cpp
+++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp
@@ -59,6 +59,11 @@ QT_BEGIN_NAMESPACE
function, and exporting the class using the Q_EXPORT_PLUGIN2()
macro.
+ QML extension plugins can be used to provide either application-specific or
+ library-like plugins. Library plugins should limit themselves to registering types,
+ as any manipulation of the engine's root context may cause conflicts
+ or other issues in the library user's code.
+
See \l {Extending QML in C++} for details how to write a QML extension plugin.
See \l {How to Create Qt Plugins} for general Qt plugin documentation.
@@ -85,7 +90,7 @@ QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(QObject *parent)
}
/*!
- Destructor.
+ Destroys the plugin.
*/
QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin()
{
@@ -94,7 +99,9 @@ QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin()
/*!
\fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
- Initializes the extension from the \a uri using the \a engine.
+ Initializes the extension from the \a uri using the \a engine. Here an application
+ plugin might, for example, expose some data or objects to QML,
+ as context properties on the engine's root context.
*/
void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index b992b9f..4be3472 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -45,31 +45,39 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeImageProvider
- \brief The QDeclarativeImageProvider class provides an interface for threaded image requests.
+ \since 4.7
+ \brief The QDeclarativeImageProvider class provides an interface for threaded image requests in QML.
- Note: the request() method may be called by multiple threads, so ensure the
+ QDeclarativeImageProvider can be used by a QDeclarativeEngine to provide images to QML asynchronously.
+ The image request will be run in a low priority thread, allowing potentially costly image
+ loading to be done in the background, without affecting the performance of the UI.
+
+ See the QDeclarativeEngine::addImageProvider() documentation for an
+ example of how a custom QDeclarativeImageProvider can be constructed and used.
+
+ \note the request() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
\sa QDeclarativeEngine::addImageProvider()
*/
/*!
- The destructor is virtual.
+ Destroys the image provider.
*/
QDeclarativeImageProvider::~QDeclarativeImageProvider()
{
}
/*!
- \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requested_size)
+ \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requestedSize)
Implement this method to return the image with \a id.
- If \a requested_size is a valid size, resize the image to that size before returning.
+ If \a requestedSize is a valid size, the image returned should be of that size.
- In any case, \a size must be set to the (original) size of the image.
+ In all cases, \a size must be set to the original size of the image.
- Note: this method may be called by multiple threads, so ensure the
+ \note this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
*/
diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h
index 50b73fe..cc9c9af 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.h
+++ b/src/declarative/qml/qdeclarativeimageprovider.h
@@ -54,7 +54,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeImageProvider
{
public:
virtual ~QDeclarativeImageProvider();
- virtual QImage request(const QString &id, QSize *size, const QSize& requested_size) = 0;
+ virtual QImage request(const QString &id, QSize *size, const QSize& requestedSize) = 0;
};
QT_END_NAMESPACE
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/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index d88d06a..99f1cc8 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -149,9 +149,6 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
case QDeclarativeInstruction::StoreSignal:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
break;
- case QDeclarativeInstruction::StoreScript:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT\t\t" << instr->storeScript.value;
- break;
case QDeclarativeInstruction::StoreImportedScript:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value;
break;
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index e8287c0..c09b157 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -121,7 +121,6 @@ public:
StoreInterface, /* storeObject */
StoreSignal, /* storeSignal */
- StoreScript, /* storeScript */
StoreImportedScript, /* storeScript */
StoreScriptString, /* storeScriptString */
diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp
index 45b8cd7..31ef4c2 100644
--- a/src/declarative/qml/qdeclarativelist.cpp
+++ b/src/declarative/qml/qdeclarativelist.cpp
@@ -87,9 +87,10 @@ void QDeclarativeListReferencePrivate::release()
/*!
\class QDeclarativeListReference
+\since 4.7
\brief The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties.
-QDeclarativeListReference allows programs to read from, and assign values to a QML list property in a
+QDeclarativeListReference allows C++ programs to read from, and assign values to a QML list property in a
simple and type safe way. A QDeclarativeListReference can be created by passing an object and property
name or through a QDeclarativeProperty instance. These two are equivalant:
@@ -304,6 +305,7 @@ int QDeclarativeListReference::count() const
/*!
\class QDeclarativeListProperty
+\since 4.7
\brief The QDeclarativeListProperty class allows applications to explose list-like
properties to QML.
@@ -313,10 +315,10 @@ The use of a list property from QML looks like this:
\code
FruitBasket {
fruit: [
- Apple {},
- Orange{},
- Banana {}
- ]
+ Apple {},
+ Orange{},
+ Banana{}
+ ]
}
\endcode
@@ -336,6 +338,9 @@ Q_PROPERTY(QDeclarativeListProperty<Fruit> fruit READ fruit);
QML list properties are typesafe - in this case \c {Fruit} is a QObject type that
\c {Apple}, \c {Orange} and \c {Banana} all derive from.
+
+\note QDeclarativeListProperty can only be used for lists of QObject-derived object pointers.
+
*/
/*!
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/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
index 9dd7d39..f5f1a1f 100644
--- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
@@ -56,12 +56,17 @@ QT_BEGIN_NAMESPACE
To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and implement
the create() method.
+ To use a factory, assign it to the relevant QDeclarativeEngine using
+ QDeclarativeEngine::setNetworkAccessManagerFactory().
+
If the created QNetworkAccessManager becomes invalid, due to a
change in proxy settings, for example, call the invalidate() method.
This will cause all QNetworkAccessManagers to be recreated.
Note: the create() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
+
+ \sa QDeclarativeEngine::setNetworkAccessManagerFactory()
*/
/*!
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 5773fe6..a194354 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();
}
}
@@ -458,12 +463,21 @@ QStringList QDeclarativeObjectScriptClass::propertyNames(Object *object)
cache = ddata->propertyCache;
if (!cache) {
cache = enginePrivate->cache(obj);
- if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; }
+ if (cache) {
+ if (ddata) { cache->addref(); ddata->propertyCache = cache; }
+ } else {
+ // Not cachable - fall back to QMetaObject (eg. dynamic meta object)
+ // XXX QDeclarativeOpenMetaObject has a cache, so this is suboptimal.
+ // XXX This is a workaround for QTBUG-9420.
+ const QMetaObject *mo = obj->metaObject();
+ QStringList r;
+ int pc = mo->propertyCount();
+ int po = mo->propertyOffset();
+ for (int i=po; i<pc; ++i)
+ r += QString::fromUtf8(mo->property(i).name());
+ return r;
+ }
}
-
- if (!cache)
- return QStringList();
-
return cache->propertyNames();
}
diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index d1f209a..b38bd76 100644
--- a/src/declarative/qml/qdeclarativeparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -89,8 +89,6 @@ QDeclarativeParser::Object::~Object()
prop.first->release();
foreach(const DynamicProperty &prop, dynamicProperties)
if (prop.defaultValue) prop.defaultValue->release();
- foreach(Object *obj, scriptBlockObjects)
- obj->release();
}
void Object::setBindingBit(int b)
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 00fc65b..0870cfb 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -160,8 +160,6 @@ namespace QDeclarativeParser
Property *defaultProperty;
QHash<QByteArray, Property *> properties;
- QList<Object *> scriptBlockObjects;
-
// Output of the compilation phase (these properties continue to exist
// in either the defaultProperty or properties members too)
void addValueProperty(Property *);
@@ -190,7 +188,9 @@ namespace QDeclarativeParser
QList<int> lineNumbers;
QList<Pragmas> pragmas;
};
+#if 0
QList<ScriptBlock> scripts;
+#endif
// The bytes to cast instances by to get to the QDeclarativeParserStatus
// interface. -1 indicates the type doesn't support this interface.
diff --git a/src/declarative/qml/qdeclarativeparserstatus.cpp b/src/declarative/qml/qdeclarativeparserstatus.cpp
index ec6260e..978bfb4 100644
--- a/src/declarative/qml/qdeclarativeparserstatus.cpp
+++ b/src/declarative/qml/qdeclarativeparserstatus.cpp
@@ -45,8 +45,36 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeParserStatus
- \since 4.7
- \brief The QDeclarativeParserStatus class provides updates on the parser state.
+ \since 4.7
+ \brief The QDeclarativeParserStatus class provides updates on the QML parser state.
+
+ QDeclarativeParserStatus provides a mechanism for classes instantiated by
+ a QDeclarativeEngine to receive notification at key points in their creation.
+
+ This class is often used for optimization purposes, as it allows you to defer an
+ expensive operation until after all the properties have been set on an
+ object. For example, QML's \l {Text} element uses the parser status
+ to defer text layout until all of its properties have been set (we
+ don't want to layout when the \c text is assigned, and then relayout
+ when the \c font is assigned, and relayout again when the \c width is assigned,
+ and so on).
+
+ To use QDeclarativeParserStatus, you must inherit both a QObject-derived class
+ and QDeclarativeParserStatus, and use the Q_INTERFACES() macro.
+
+ \code
+ class MyObject : public QObject, public QDeclarativeParserStatus
+ {
+ Q_OBJECT
+ Q_INTERFACES(QDeclarativeParserStatus)
+
+ public:
+ MyObject(QObject *parent = 0);
+ ...
+ void classBegin();
+ void componentComplete();
+ }
+ \endcode
*/
/*! \internal */
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index afd0d84..3881d0a 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeProperty
+\since 4.7
\brief The QDeclarativeProperty class abstracts accessing properties on objects created from QML.
As QML uses Qt's meta-type system all of the existing QMetaObject classes can be used to introspect
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/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index ac49332..e7c8a12 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -296,27 +296,12 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if (lastTypeDot >= 0)
resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/'));
- bool isScript = resolvableObjectType == QLatin1String("Script");
-
- if (isScript) {
- if (_stateStack.isEmpty() || _stateStack.top().property) {
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid use of Script block"));
- error.setLine(typeLocation.startLine);
- error.setColumn(typeLocation.startColumn);
- _parser->_errors << error;
- return 0;
- }
- }
-
Object *obj = new Object;
- if (!isScript) {
- QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
- obj->type = typeRef->id;
+ QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
+ obj->type = typeRef->id;
- typeRef->refObjects.append(obj);
- }
+ typeRef->refObjects.append(obj);
// XXX this doesn't do anything (_scope never builds up)
_scope.append(resolvableObjectType);
@@ -325,11 +310,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
obj->location = location;
- if (isScript) {
-
- _stateStack.top().object->scriptBlockObjects.append(obj);
-
- } else if (propertyCount) {
+ if (propertyCount) {
Property *prop = currentProperty();
Value *v = new Value;
@@ -535,7 +516,6 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
// { "time", Object::DynamicProperty::Time, "QTime" },
// { "date", Object::DynamicProperty::Date, "QDate" },
{ "date", Object::DynamicProperty::DateTime, "QDateTime" },
- { "var", Object::DynamicProperty::Variant, "QVariant" },
{ "variant", Object::DynamicProperty::Variant, "QVariant" }
};
const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
@@ -647,11 +627,6 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.location = location(node->firstSourceLocation(),
node->lastSourceLocation());
- if (memberType == QLatin1String("var"))
- qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":"
- << property.location.start.column << ": var type has been replaced by variant. "
- << "Support will be removed entirely shortly.";
-
if (node->expression) { // default value
property.defaultValue = new Property;
property.defaultValue->parent = _stateStack.top().object;
@@ -827,62 +802,29 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
{
QDeclarativeParser::Object *obj = currentObject();
- bool isScript = (obj && obj->typeName == "Script");
-
- if (!isScript) {
-
- if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
+ if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
- Object::DynamicSlot slot;
- slot.location = location(funDecl->firstSourceLocation(), funDecl->lastSourceLocation());
+ Object::DynamicSlot slot;
+ slot.location = location(funDecl->firstSourceLocation(), funDecl->lastSourceLocation());
- AST::FormalParameterList *f = funDecl->formals;
- while (f) {
- slot.parameterNames << f->name->asString().toUtf8();
- f = f->finish();
- }
-
- QString body = textAt(funDecl->lbraceToken, funDecl->rbraceToken);
- slot.name = funDecl->name->asString().toUtf8();
- slot.body = body;
- obj->dynamicSlots << slot;
-
- } else {
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser","JavaScript declaration outside Script element"));
- error.setLine(node->firstSourceLocation().startLine);
- error.setColumn(node->firstSourceLocation().startColumn);
- _parser->_errors << error;
+ AST::FormalParameterList *f = funDecl->formals;
+ while (f) {
+ slot.parameterNames << f->name->asString().toUtf8();
+ f = f->finish();
}
- return false;
-
- } else {
- QString source;
- int line = 0;
- if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
- line = funDecl->functionToken.startLine;
- source = asString(funDecl);
- } else if (AST::VariableStatement *varStmt = AST::cast<AST::VariableStatement *>(node->sourceElement)) {
- // ignore variable declarations
- line = varStmt->declarationKindToken.startLine;
+ QString body = textAt(funDecl->lbraceToken, funDecl->rbraceToken);
+ slot.name = funDecl->name->asString().toUtf8();
+ slot.body = body;
+ obj->dynamicSlots << slot;
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser", "Variable declarations not allow in inline Script blocks"));
- error.setLine(node->firstSourceLocation().startLine);
- error.setColumn(node->firstSourceLocation().startColumn);
- _parser->_errors << error;
- return false;
- }
-
- Value *value = new Value;
- value->location = location(node->firstSourceLocation(),
- node->lastSourceLocation());
- value->value = QDeclarativeParser::Variant(source);
-
- obj->getDefaultProperty()->addValue(value);
+ } else {
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","JavaScript declaration outside Script element"));
+ error.setLine(node->firstSourceLocation().startLine);
+ error.setColumn(node->firstSourceLocation().startColumn);
+ _parser->_errors << error;
}
-
return false;
}
diff --git a/src/declarative/qml/qdeclarativescriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp
index 5b9afe9..8f717d1 100644
--- a/src/declarative/qml/qdeclarativescriptstring.cpp
+++ b/src/declarative/qml/qdeclarativescriptstring.cpp
@@ -55,24 +55,35 @@ public:
/*!
\class QDeclarativeScriptString
- \since 4.7
+\since 4.7
\brief The QDeclarativeScriptString class encapsulates a script and its context.
-The QDeclarativeScriptString is used by properties that want to accept a script "assignment" from QML.
+QDeclarativeScriptString is used to create QObject properties that accept a script "assignment" from QML.
-Normally, the following code would result in a binding being established for the \c script
-property. If the property had a type of QDeclarativeScriptString, the script - \e {console.log(1921)} - itself
-would be passed to the property and it could choose how to handle it.
+Normally, the following QML would result in a binding being established for the \c script
+property; i.e. \c script would be assigned the value obtained from running \c {myObj.value = Math.max(myValue, 100)}
-\code
+\qml
MyType {
- script: console.log(1921)
+ script: myObj.value = Math.max(myValue, 100)
}
+\endqml
+
+If instead the property had a type of QDeclarativeScriptString,
+the script itself -- \e {myObj.value = Math.max(myValue, 100)} -- would be passed to the \c script property
+and the class could choose how to handle it. Typically, the class will evaluate
+the script at some later time using a QDeclarativeExpression.
+
+\code
+QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject());
+expr.value();
\endcode
+
+\sa QDeclarativeExpression
*/
/*!
-Construct an empty instance.
+Constructs an empty instance.
*/
QDeclarativeScriptString::QDeclarativeScriptString()
: d(new QDeclarativeScriptStringPrivate)
@@ -80,7 +91,7 @@ QDeclarativeScriptString::QDeclarativeScriptString()
}
/*!
-Copy \a other.
+Copies \a other.
*/
QDeclarativeScriptString::QDeclarativeScriptString(const QDeclarativeScriptString &other)
: d(other.d)
@@ -95,7 +106,7 @@ QDeclarativeScriptString::~QDeclarativeScriptString()
}
/*!
-Assign \a other to this.
+Assigns \a other to this.
*/
QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarativeScriptString &other)
{
@@ -104,7 +115,7 @@ QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarative
}
/*!
-Return the context for the script.
+Returns the context for the script.
*/
QDeclarativeContext *QDeclarativeScriptString::context() const
{
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index 352a6c0..c5f6d6a 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -55,13 +55,13 @@ int qmlRegisterValueTypeEnums(const char *qmlName)
QByteArray pointerName(name + '*');
QDeclarativePrivate::RegisterType type = {
- 0,
+ 0,
qRegisterMetaType<T *>(pointerName.constData()), 0, 0, 0,
"Qt", 4, 6, qmlName, &T::staticMetaObject,
- 0, 0,
+ 0, 0,
0, 0, 0,
@@ -712,7 +712,7 @@ int QDeclarativeFontValueType::pixelSize() const
void QDeclarativeFontValueType::setPixelSize(int size)
{
- if (size >=0) {
+ if (size >0) {
if (pointSizeSet)
qWarning() << "Both point size and pixel size set. Using pixel size.";
font.setPixelSize(size);
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index fdcbeee..57bf726 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -623,13 +623,6 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
}
break;
- case QDeclarativeInstruction::StoreScript:
- {
- QObject *target = stack.top();
- ctxt->addScript(scripts.at(instr.storeScript.value), target);
- }
- break;
-
case QDeclarativeInstruction::StoreImportedScript:
{
ctxt->addImportedScript(scripts.at(instr.storeScript.value));
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index c4d47b3..45f04a0 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -86,7 +86,6 @@ public:
inline void setValue(const QDate &);
inline void setValue(const QDateTime &);
inline void setValue(const QScriptValue &);
-
private:
int type;
void *data[4]; // Large enough to hold all types
@@ -112,6 +111,9 @@ void QDeclarativeVMEVariant::cleanup()
type == QMetaType::Bool ||
type == QMetaType::Double) {
type = QVariant::Invalid;
+ } else if (type == QMetaType::QObjectStar) {
+ ((QDeclarativeGuard<QObject>*)dataPtr())->~QDeclarativeGuard<QObject>();
+ type = QVariant::Invalid;
} else if (type == QMetaType::QString) {
((QString *)dataPtr())->~QString();
type = QVariant::Invalid;
@@ -160,7 +162,7 @@ QObject *QDeclarativeVMEVariant::asQObject()
if (type != QMetaType::QObjectStar)
setValue((QObject *)0);
- return *(QObject **)(dataPtr());
+ return *(QDeclarativeGuard<QObject> *)(dataPtr());
}
const QVariant &QDeclarativeVMEVariant::asQVariant()
@@ -256,8 +258,9 @@ void QDeclarativeVMEVariant::setValue(QObject *v)
if (type != QMetaType::QObjectStar) {
cleanup();
type = QMetaType::QObjectStar;
+ new (dataPtr()) QDeclarativeGuard<QObject>();
}
- *(QObject **)(dataPtr()) = v;
+ *(QDeclarativeGuard<QObject>*)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(const QVariant &v)
@@ -465,8 +468,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = readVarPropertyAsVariant(id);
} else if (c == QMetaObject::WriteProperty) {
- needActivate = (data[id].asQVariant() != *reinterpret_cast<QVariant *>(a[0]));
- data[id].setValue(*reinterpret_cast<QVariant *>(a[0]));
+ writeVarProperty(id, *reinterpret_cast<QVariant *>(a[0]));
}
} else {
@@ -682,6 +684,8 @@ QScriptValue QDeclarativeVMEMetaObject::readVarProperty(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>())
return data[id].asQScriptValue();
+ else if (data[id].dataType() == QMetaType::QObjectStar)
+ return QDeclarativeEnginePrivate::get(ctxt->engine)->objectClass->newQObject(data[id].asQObject());
else
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueFromVariant(data[id].asQVariant());
}
@@ -690,7 +694,9 @@ QVariant QDeclarativeVMEMetaObject::readVarPropertyAsVariant(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>())
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueToVariant(data[id].asQScriptValue());
- else
+ else if (data[id].dataType() == QMetaType::QObjectStar)
+ return QVariant::fromValue(data[id].asQObject());
+ else
return data[id].asQVariant();
}
@@ -700,6 +706,15 @@ void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QScriptValue &val
activate(object, methodOffset + id, 0);
}
+void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QVariant &value)
+{
+ if (value.userType() == QMetaType::QObjectStar)
+ data[id].setValue(qvariant_cast<QObject *>(value));
+ else
+ data[id].setValue(value);
+ activate(object, methodOffset + id, 0);
+}
+
void QDeclarativeVMEMetaObject::listChanged(int id)
{
activate(object, methodOffset + id, 0);
diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h
index 76390c9..4fc3269 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject_p.h
+++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h
@@ -148,6 +148,7 @@ private:
QScriptValue readVarProperty(int);
QVariant readVarPropertyAsVariant(int);
void writeVarProperty(int, const QScriptValue &);
+ void writeVarProperty(int, const QVariant &);
QAbstractDynamicMetaObject *parent;
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 7e20428..27f37df 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();
}
}
@@ -1316,7 +1316,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t)
}
/*!
- \qmlproperty enum RotationAnimation::direction
+ \qmlproperty enumeration RotationAnimation::direction
The direction in which to rotate.
Possible values are Numerical, Clockwise, Counterclockwise,
or Shortest.
@@ -1741,14 +1741,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty enum PropertyAnimation::easing.type
+ \qmlproperty enumeration PropertyAnimation::easing.type
\qmlproperty real PropertyAnimation::easing.amplitude
\qmlproperty real PropertyAnimation::easing.overshoot
\qmlproperty real PropertyAnimation::easing.period
\brief the easing curve used for the animation.
To specify an easing curve you need to specify at least the type. For some curves you can also specify
- amplitude, period and/or overshoot (more details provided after the table).
+ amplitude, period and/or overshoot (more details provided after the table). The default easing curve is
+ Linear.
\qml
PropertyAnimation { properties: "y"; easing.type: "InOutElastic"; easing.amplitude: 2.0; easing.period: 1.5 }
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index b577b81..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
@@ -181,7 +182,7 @@ void QDeclarativeFontLoader::setName(const QString &name)
}
/*!
- \qmlproperty enum FontLoader::status
+ \qmlproperty enumeration FontLoader::status
This property holds the status of font loading. It can be one of:
\list
@@ -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/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp
index 0e477b1..c8161a7 100644
--- a/src/declarative/util/qdeclarativepropertymap.cpp
+++ b/src/declarative/util/qdeclarativepropertymap.cpp
@@ -98,7 +98,7 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
/*!
\class QDeclarativePropertyMap
\since 4.7
- \brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in bindings.
+ \brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in QML bindings.
QDeclarativePropertyMap provides a convenient way to expose domain data to the UI layer.
The following example shows how you might declare data in C++ and then
@@ -112,7 +112,7 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
ownerData.insert("phone", QVariant(QString("555-5555")));
//expose it to the UI layer
- QDeclarativeContext *ctxt = view->bindContext();
+ QDeclarativeContext *ctxt = view->rootContext();
ctxt->setProperty("owner", &data);
\endcode
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 48a7583..19a00ee 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -438,7 +438,7 @@ qreal QDeclarativeSmoothedAnimation::velocity() const
}
/*!
- \qmlproperty qreal SmoothedAnimation::velocity
+ \qmlproperty real SmoothedAnimation::velocity
This property holds the average velocity allowed when tracking the 'to' value.
@@ -457,7 +457,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v)
}
/*!
- \qmlproperty qreal SmoothedAnimation::maximumEasingTime
+ \qmlproperty int SmoothedAnimation::maximumEasingTime
This property specifies the maximum time, in msecs, an "eases" during the follow should take.
Setting this property causes the velocity to "level out" after at a time. Setting
diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp
index 9f155fc..3ed9257 100644
--- a/src/declarative/util/qdeclarativesmoothedfollow.cpp
+++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp
@@ -195,7 +195,7 @@ qreal QDeclarativeSmoothedFollow::velocity() const
}
/*!
- \qmlproperty qreal SmoothedFollow::velocity
+ \qmlproperty real SmoothedFollow::velocity
This property holds the average velocity allowed when tracking the 'to' value.
@@ -214,7 +214,7 @@ void QDeclarativeSmoothedFollow::setVelocity(qreal v)
}
/*!
- \qmlproperty qreal SmoothedFollow::maximumEasingTime
+ \qmlproperty int SmoothedFollow::maximumEasingTime
This property specifies the maximum time, in msecs, an "eases" during the follow should take.
Setting this property causes the velocity to "level out" after at a time. Setting
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 7921735..70077f3 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -267,7 +267,7 @@ qreal QDeclarativeSpringFollow::to() const
}
/*!
- \qmlproperty qreal SpringFollow::to
+ \qmlproperty real SpringFollow::to
This property holds the target value which will be tracked.
Bind to a property in order to track its changes.
@@ -284,7 +284,7 @@ void QDeclarativeSpringFollow::setTo(qreal value)
}
/*!
- \qmlproperty qreal SpringFollow::velocity
+ \qmlproperty real SpringFollow::velocity
This property holds the maximum velocity allowed when tracking the source.
*/
@@ -303,7 +303,7 @@ void QDeclarativeSpringFollow::setVelocity(qreal velocity)
}
/*!
- \qmlproperty qreal SpringFollow::spring
+ \qmlproperty real SpringFollow::spring
This property holds the spring constant
The spring constant describes how strongly the target is pulled towards the
@@ -326,7 +326,7 @@ void QDeclarativeSpringFollow::setSpring(qreal spring)
}
/*!
- \qmlproperty qreal SpringFollow::damping
+ \qmlproperty real SpringFollow::damping
This property holds the spring damping constant
The damping constant describes how quickly a sprung follower comes to rest.
@@ -349,7 +349,7 @@ void QDeclarativeSpringFollow::setDamping(qreal damping)
/*!
- \qmlproperty qreal SpringFollow::epsilon
+ \qmlproperty real SpringFollow::epsilon
This property holds the spring epsilon
The epsilon is the rate and amount of change in the value which is close enough
@@ -371,7 +371,7 @@ void QDeclarativeSpringFollow::setEpsilon(qreal epsilon)
}
/*!
- \qmlproperty qreal SpringFollow::modulus
+ \qmlproperty real SpringFollow::modulus
This property holds the modulus value.
Setting a \a modulus forces the target value to "wrap around" at the modulus.
@@ -394,7 +394,7 @@ void QDeclarativeSpringFollow::setModulus(qreal modulus)
}
/*!
- \qmlproperty qreal SpringFollow::mass
+ \qmlproperty real SpringFollow::mass
This property holds the "mass" of the property being moved.
mass is 1.0 by default. Setting a different mass changes the dynamics of
@@ -452,7 +452,7 @@ bool QDeclarativeSpringFollow::inSync() const
}
/*!
- \qmlproperty qreal SpringFollow::value
+ \qmlproperty real SpringFollow::value
The current value.
*/
qreal QDeclarativeSpringFollow::value() const
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/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h
index d1e6630..08c3d4e 100644
--- a/src/declarative/util/qdeclarativetimer_p.h
+++ b/src/declarative/util/qdeclarativetimer_p.h
@@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarati
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged)
Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged)
+ Q_PROPERTY(QObject *parent READ parent CONSTANT)
public:
QDeclarativeTimer(QObject *parent=0);
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index c0425ef..5cfa0e8 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -59,10 +59,14 @@
#include <qfontdatabase.h>
#include <qicon.h>
#include <qurl.h>
-#include <qboxlayout.h>
+#include <qlayout.h>
+#include <qwidget.h>
+#include <qgraphicswidget.h>
#include <qbasictimer.h>
#include <QtCore/qabstractanimation.h>
#include <private/qgraphicsview_p.h>
+#include <private/qdeclarativeitem_p.h>
+#include <private/qdeclarativeitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
@@ -124,19 +128,23 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
server->frameBreak();
}
-class QDeclarativeViewPrivate
+class QDeclarativeViewPrivate : public QDeclarativeItemChangeListener
{
public:
QDeclarativeViewPrivate(QDeclarativeView *view)
- : q(view), root(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
+ : q(view), root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
~QDeclarativeViewPrivate() { delete root; }
-
void execute();
+ void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void initResize();
+ void updateSize();
+ inline QSize rootObjectSize();
QDeclarativeView *q;
QDeclarativeGuard<QGraphicsObject> root;
- QDeclarativeGuard<QDeclarativeItem> qmlRoot;
+ QDeclarativeGuard<QDeclarativeItem> declarativeItemRoot;
+ QDeclarativeGuard<QGraphicsWidget> graphicsWidgetRoot;
QUrl source;
@@ -144,7 +152,6 @@ public:
QDeclarativeComponent *component;
QBasicTimer resizetimer;
- mutable QSize initialSize;
QDeclarativeView::ResizeMode resizeMode;
QTime frameTimer;
@@ -155,18 +162,32 @@ public:
void QDeclarativeViewPrivate::execute()
{
- delete root;
- delete component;
- initialSize = QSize();
- component = new QDeclarativeComponent(&engine, source, q);
-
- if (!component->isLoading()) {
- q->continueExecute();
- } else {
- QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ if (root) {
+ delete root;
+ root = 0;
+ }
+ if (component) {
+ delete component;
+ component = 0;
+ }
+ if (!source.isEmpty()) {
+ component = new QDeclarativeComponent(&engine, source, q);
+ if (!component->isLoading()) {
+ q->continueExecute();
+ } else {
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ }
}
}
+void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ // wait for both width and height to be changed
+ resizetimer.start(0,q);
+ }
+ QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
+}
/*!
\class QDeclarativeView
@@ -332,21 +353,20 @@ QDeclarativeContext* QDeclarativeView::rootContext()
/*!
\enum QDeclarativeView::Status
-
Specifies the loading status of the QDeclarativeView.
\value Null This QDeclarativeView has no source set.
\value Ready This QDeclarativeView has loaded and created the QML component.
\value Loading This QDeclarativeView is loading network data.
- \value Error An error has occured. Calling errorDescription() to retrieve a description.
+ \value Error An error has occured. Call errorDescription() to retrieve a description.
*/
/*! \enum QDeclarativeView::ResizeMode
This enum specifies how to resize the view.
- \value SizeViewToRootObject
- \value SizeRootObjectToView
+ \value SizeViewToRootObject The view resizes with the root item in the QML.
+ \value SizeRootObjectToView The view will automatically resize the root item to the size of the view.
*/
/*!
@@ -373,7 +393,6 @@ QList<QDeclarativeError> QDeclarativeView::errors() const
return QList<QDeclarativeError>();
}
-
/*!
\property QDeclarativeView::resizeMode
\brief whether the view should resize the canvas contents
@@ -394,16 +413,92 @@ void QDeclarativeView::setResizeMode(ResizeMode mode)
if (d->resizeMode == mode)
return;
+ if (d->declarativeItemRoot) {
+ if (d->resizeMode == SizeViewToRootObject) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(d->declarativeItemRoot));
+ p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
+ }
+ } else if (d->graphicsWidgetRoot) {
+ if (d->resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ d->graphicsWidgetRoot->removeEventFilter(this);
+ }
+ }
+
d->resizeMode = mode;
- if (d->qmlRoot) {
- if (d->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
- } else {
- d->qmlRoot->setWidth(d->initialSize.width());
- d->qmlRoot->setHeight(d->initialSize.height());
+ if (d->root) {
+ d->initResize();
+ }
+}
+
+void QDeclarativeViewPrivate::initResize()
+{
+ if (declarativeItemRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(declarativeItemRoot));
+ p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
+ }
+ } else if (graphicsWidgetRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ graphicsWidgetRoot->installEventFilter(q);
+ }
+ }
+ updateSize();
+}
+
+void QDeclarativeViewPrivate::updateSize()
+{
+ if (!root)
+ return;
+ if (declarativeItemRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QSize newSize = QSize(declarativeItemRoot->width(), declarativeItemRoot->height());
+ if (newSize.isValid() && newSize != q->size()) {
+ q->resize(newSize);
+ }
+ } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) {
+ if (!qFuzzyCompare(q->width(), declarativeItemRoot->width()))
+ declarativeItemRoot->setWidth(q->width());
+ if (!qFuzzyCompare(q->height(), declarativeItemRoot->height()))
+ declarativeItemRoot->setHeight(q->height());
}
+ } else if (graphicsWidgetRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QSize newSize = QSize(graphicsWidgetRoot->size().width(), graphicsWidgetRoot->size().height());
+ if (newSize.isValid() && newSize != q->size()) {
+ q->resize(newSize);
+ }
+ } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) {
+ QSizeF newSize = QSize(q->size().width(), q->size().height());
+ if (newSize.isValid() && newSize != graphicsWidgetRoot->size()) {
+ graphicsWidgetRoot->resize(newSize);
+ }
+ }
+ }
+ q->updateGeometry();
+}
+
+QSize QDeclarativeViewPrivate::rootObjectSize()
+{
+ QSize rootObjectSize(0,0);
+ int widthCandidate = -1;
+ int heightCandidate = -1;
+ if (declarativeItemRoot) {
+ widthCandidate = declarativeItemRoot->width();
+ heightCandidate = declarativeItemRoot->height();
+ } else if (root) {
+ QSizeF size = root->boundingRect().size();
+ widthCandidate = size.width();
+ heightCandidate = size.height();
+ }
+ if (widthCandidate > 0) {
+ rootObjectSize.setWidth(widthCandidate);
}
+ if (heightCandidate > 0) {
+ rootObjectSize.setHeight(heightCandidate);
+ }
+ return rootObjectSize;
}
QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const
@@ -449,55 +544,46 @@ void QDeclarativeView::continueExecute()
*/
void QDeclarativeView::setRootObject(QObject *obj)
{
- if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(obj)) {
- d->scene.addItem(item);
-
- d->root = item;
- d->qmlRoot = item;
- connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
- connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
- if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0)
- d->initialSize.setWidth(d->qmlRoot->width());
- if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0)
- d->initialSize.setHeight(d->qmlRoot->height());
- resize(d->initialSize);
-
- if (d->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
+ if (d->root == obj)
+ return;
+ if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem *>(obj)) {
+ d->scene.addItem(declarativeItem);
+ d->root = declarativeItem;
+ d->declarativeItemRoot = declarativeItem;
+ } else if (QGraphicsObject *graphicsObject = qobject_cast<QGraphicsObject *>(obj)) {
+ d->scene.addItem(graphicsObject);
+ d->root = graphicsObject;
+ if (graphicsObject->isWidget()) {
+ d->graphicsWidgetRoot = static_cast<QGraphicsWidget*>(graphicsObject);
} else {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- resize(sz);
+ qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
}
- updateGeometry();
- } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
- d->scene.addItem(item);
- qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
- } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
- window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
- window()->setAttribute(Qt::WA_NoSystemBackground, false);
- if (!layout()) {
- setLayout(new QVBoxLayout);
- layout()->setContentsMargins(0, 0, 0, 0);
- } else if (layout()->count()) {
- // Hide the QGraphicsView in GV mode.
- QLayoutItem *item = layout()->itemAt(0);
- if (item->widget())
- item->widget()->hide();
+ } else if (obj) {
+ qWarning() << "QDeclarativeView only supports loading of root objects that derive from QGraphicsObject";
+ if (QWidget* widget = qobject_cast<QWidget *>(obj)) {
+ window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ window()->setAttribute(Qt::WA_NoSystemBackground, false);
+ if (layout() && layout()->count()) {
+ // Hide the QGraphicsView in GV mode.
+ QLayoutItem *item = layout()->itemAt(0);
+ if (item->widget())
+ item->widget()->hide();
+ }
+ widget->setParent(this);
+ if (isVisible()) {
+ widget->setVisible(true);
+ }
+ resize(widget->size());
}
- layout()->addWidget(wid);
- emit sceneResized(wid->size());
}
-}
-/*!
- \internal
- */
-void QDeclarativeView::sizeChanged()
-{
- // delay, so we catch both width and height changing.
- d->resizetimer.start(0,this);
+ if (d->root) {
+ QSize initialSize = d->rootObjectSize();
+ if (initialSize != size()) {
+ resize(initialSize);
+ }
+ d->initResize();
+ }
}
/*!
@@ -508,30 +594,36 @@ void QDeclarativeView::sizeChanged()
void QDeclarativeView::timerEvent(QTimerEvent* e)
{
if (!e || e->timerId() == d->resizetimer.timerId()) {
- if (d->qmlRoot) {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- //if (!d->resizable)
- //resize(sz);
- }
+ d->updateSize();
d->resizetimer.stop();
- updateGeometry();
}
}
+bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e)
+{
+ if (watched == d->root && d->resizeMode == SizeViewToRootObject) {
+ if (d->graphicsWidgetRoot) {
+ if (e->type() == QEvent::GraphicsSceneResize) {
+ d->updateSize();
+ }
+ }
+ }
+ return QGraphicsView::eventFilter(watched, e);
+}
+
/*!
\internal
- The size hint is the size of the root item.
+ Preferred size follows the root object in
+ resize mode SizeViewToRootObject and
+ the view in resize mode SizeRootObjectToView.
*/
QSize QDeclarativeView::sizeHint() const
{
- if (d->qmlRoot) {
- if (d->initialSize.width() <= 0)
- d->initialSize.setWidth(d->qmlRoot->width());
- if (d->initialSize.height() <= 0)
- d->initialSize.setHeight(d->qmlRoot->height());
+ if (d->resizeMode == SizeRootObjectToView) {
+ return size();
+ } else { // d->resizeMode == SizeViewToRootObject
+ return d->rootObjectSize();
}
- return d->initialSize;
}
/*!
@@ -549,17 +641,17 @@ QGraphicsObject *QDeclarativeView::rootObject() const
*/
void QDeclarativeView::resizeEvent(QResizeEvent *e)
{
- if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
+ if (d->resizeMode == SizeRootObjectToView) {
+ d->updateSize();
}
- if (d->qmlRoot) {
- setSceneRect(QRectF(0, 0, d->qmlRoot->width(), d->qmlRoot->height()));
+ if (d->declarativeItemRoot) {
+ setSceneRect(QRectF(0, 0, d->declarativeItemRoot->width(), d->declarativeItemRoot->height()));
} else if (d->root) {
setSceneRect(d->root->boundingRect());
} else {
setSceneRect(rect());
}
+ emit sceneResized(e->size());
QGraphicsView::resizeEvent(e);
}
diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h
index 107f3f9..1807758 100644
--- a/src/declarative/util/qdeclarativeview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -97,13 +97,13 @@ Q_SIGNALS:
private Q_SLOTS:
void continueExecute();
- void sizeChanged();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *event);
virtual void timerEvent(QTimerEvent*);
virtual void setRootObject(QObject *obj);
+ virtual bool eventFilter(QObject *watched, QEvent *e);
friend class QDeclarativeViewPrivate;
QDeclarativeViewPrivate *d;
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 7f8b962..55e768e 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -667,7 +667,7 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
}
/*!
- \qmlproperty enum XmlListModel::status
+ \qmlproperty enumeration XmlListModel::status
Specifies the model loading status, which can be one of the following:
\list
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 9759b39..e290c7e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1237,6 +1237,8 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
dirtySceneTransform = 1;
+ if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
+ transformChanged();
// Restore the sub focus chain.
if (subFocusItem) {
@@ -3622,6 +3624,7 @@ void QGraphicsItemPrivate::setTransformHelper(const QTransform &transform)
q_ptr->prepareGeometryChange();
transformData->transform = transform;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
@@ -3812,6 +3815,8 @@ void QGraphicsItem::setRotation(qreal angle)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->rotationChanged();
+
+ d_ptr->transformChanged();
}
/*!
@@ -3876,6 +3881,8 @@ void QGraphicsItem::setScale(qreal factor)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->scaleChanged();
+
+ d_ptr->transformChanged();
}
@@ -3931,6 +3938,7 @@ void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transf
transformations.at(i)->d_func()->setItem(this);
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
+ d_ptr->transformChanged();
}
/*!
@@ -3947,6 +3955,7 @@ void QGraphicsItemPrivate::prependGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
@@ -3963,6 +3972,7 @@ void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index f922842..8c7fbb4 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -284,6 +284,7 @@ public:
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
bool discardUpdateRequest(bool ignoreVisibleBit = false,
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
+ virtual void transformChanged() {}
int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT
enum InvalidateReason {
diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro
index b9c5b4e..f55c00e 100644
--- a/src/imports/gestures/gestures.pro
+++ b/src/imports/gestures/gestures.pro
@@ -17,8 +17,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = gesturesqmlplugin.dll \
- qmldir
+ importFiles.sources = gesturesqmlplugin.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro
index 92f7ec4..c366e54 100644
--- a/src/imports/multimedia/multimedia.pro
+++ b/src/imports/multimedia/multimedia.pro
@@ -27,8 +27,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/multimedia.dll \
- qmldir
+ importFiles.sources = multimedia.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
index 82d5d89..849c51d 100644
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ b/src/imports/multimedia/qdeclarativeaudio.cpp
@@ -195,7 +195,7 @@ void QDeclarativeAudio::stop()
*/
/*!
- \qmlproperty enum Audio::status
+ \qmlproperty enumeration Audio::status
This property holds the status of media loading. It can be one of:
@@ -263,7 +263,7 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::volume
+ \qmlproperty real Audio::volume
This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
*/
@@ -275,7 +275,7 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::bufferProgress
+ \qmlproperty real Audio::bufferProgress
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
(full).
@@ -290,13 +290,13 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::playbackRate
+ \qmlproperty real Audio::playbackRate
This property holds the rate at which audio is played at as a multiple of the normal rate.
*/
/*!
- \qmlproperty enum Audio::error
+ \qmlproperty enumeration Audio::error
This property holds the error state of the audio. It can be one of:
diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp
index c6ae272..d84d304 100644
--- a/src/imports/multimedia/qdeclarativevideo.cpp
+++ b/src/imports/multimedia/qdeclarativevideo.cpp
@@ -82,11 +82,11 @@ void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString)
Video { source: "video/movie.mpg" }
\endqml
- The video item supports untransformed, stretched, and uniformly scaled video presentation.
+ The Video item supports untransformed, stretched, and uniformly scaled video presentation.
For a description of stretched uniformly scaled presentation, see the \l fillMode property
description.
- The video item is only visible when the \l hasVideo property is true and the video is playing.
+ The Video item is only visible when the \l hasVideo property is true and the video is playing.
\sa Audio
*/
@@ -169,7 +169,7 @@ QDeclarativeVideo::~QDeclarativeVideo()
*/
/*!
- \qmlproperty enum Video::status
+ \qmlproperty enumeration Video::status
This property holds the status of media loading. It can be one of:
@@ -236,7 +236,7 @@ QDeclarativeVideo::Status QDeclarativeVideo::status() const
*/
/*!
- \qmlproperty qreal Video::volume
+ \qmlproperty real Video::volume
This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
*/
@@ -270,7 +270,7 @@ bool QDeclarativeVideo::hasVideo() const
}
/*!
- \qmlproperty qreal Video::bufferProgress
+ \qmlproperty real Video::bufferProgress
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
(full).
@@ -283,13 +283,13 @@ bool QDeclarativeVideo::hasVideo() const
*/
/*!
- \qmlproperty qreal Video::playbackRate
+ \qmlproperty real Video::playbackRate
This property holds the rate at which video is played at as a multiple of the normal rate.
*/
/*!
- \qmlproperty enum Video::error
+ \qmlproperty enumeration Video::error
This property holds the error state of the video. It can be one of:
@@ -325,7 +325,7 @@ QDeclarativeVideo::Error QDeclarativeVideo::error() const
*/
/*!
- \qmlproperty enum Video::fillMode
+ \qmlproperty enumeration Video::fillMode
Set this property to define how the video is scaled to fit the target area.
diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro
index 58bfe05..79ac543 100644
--- a/src/imports/particles/particles.pro
+++ b/src/imports/particles/particles.pro
@@ -21,8 +21,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/particles.dll \
- qmldir
+ importFiles.sources = particles.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp
index 264cba2..ecc6604 100644
--- a/src/imports/particles/qdeclarativeparticles.cpp
+++ b/src/imports/particles/qdeclarativeparticles.cpp
@@ -189,13 +189,13 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte
*/
/*!
- \qmlproperty qreal ParticleMotionGravity::xattractor
- \qmlproperty qreal ParticleMotionGravity::yattractor
+ \qmlproperty real ParticleMotionGravity::xattractor
+ \qmlproperty real ParticleMotionGravity::yattractor
These properties hold the x and y coordinates of the point attracting the particles.
*/
/*!
- \qmlproperty qreal ParticleMotionGravity::acceleration
+ \qmlproperty real ParticleMotionGravity::acceleration
This property holds the acceleration to apply to the particles.
*/
@@ -303,14 +303,14 @@ Rectangle {
*/
/*!
- \qmlproperty qreal QDeclarativeParticleMotionWander::xvariance
- \qmlproperty qreal QDeclarativeParticleMotionWander::yvariance
+ \qmlproperty real QDeclarativeParticleMotionWander::xvariance
+ \qmlproperty real QDeclarativeParticleMotionWander::yvariance
These properties set the amount to wander in the x and y directions.
*/
/*!
- \qmlproperty qreal QDeclarativeParticleMotionWander::pace
+ \qmlproperty real QDeclarativeParticleMotionWander::pace
This property holds how quickly the paricles will move from side to side.
*/
@@ -859,7 +859,7 @@ void QDeclarativeParticles::setEmissionRate(int er)
}
/*!
- \qmlproperty qreal Particles::emissionVariance
+ \qmlproperty real Particles::emissionVariance
This property holds how inconsistent the rate of particle emissions are.
It is a number between 0 (no variance) and 1 (some variance).
diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro
index 62db9ac..77cbc4d 100644
--- a/src/imports/webkit/webkit.pro
+++ b/src/imports/webkit/webkit.pro
@@ -18,8 +18,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/webkitqmlplugin.dll \
- qmldir
+ importFiles.sources = webkitqmlplugin.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
index f26e4b9..234ff1e 100644
--- a/src/imports/widgets/widgets.pro
+++ b/src/imports/widgets/widgets.pro
@@ -21,8 +21,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/widgets.dll \
- qmldir
+ importFiles.sources = widgets.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp
index d34e532..1992ee5 100644
--- a/src/multimedia/effects/qsoundeffect.cpp
+++ b/src/multimedia/effects/qsoundeffect.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass SoundEffect QSoundEffect
\since 4.7
- \brief The SoundEffect element provides a way to play sound effects in qml.
+ \brief The SoundEffect element provides a way to play sound effects in QML.
This element is part of the \bold{Qt.multimedia 4.7} module.
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty QUrl SoundEffect::source
+ \qmlproperty url SoundEffect::source
This property provides a way to control the sound to play.
*/
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index dfce7d2..c3809b2 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -143,6 +143,25 @@ symbian: {
contains(QT_CONFIG, declarative): {
qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll
+
+ widgetImport.sources = widgets.dll $$QT_BUILD_TREE/src/imports/widgets/qmldir
+ widgetImport.path = $$QT_IMPORTS_BASE_DIR/Qt/widgets
+ DEPLOYMENT += widgetImport
+
+ particlesImport.sources = particles.dll $$QT_BUILD_TREE/src/imports/particles/qmldir
+ particlesImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/particles
+ DEPLOYMENT += particlesImport
+
+ contains(QT_CONFIG, webkit): {
+ webkitImport.sources = webkitqmlplugin.dll $$QT_BUILD_TREE/src/imports/webkit/qmldir
+ webkitImport.path = $$QT_IMPORTS_BASE_DIR/org/webkit
+ DEPLOYMENT += webkitImport
+ }
+ contains(QT_CONFIG, multimedia): {
+ multimediaImport.sources = multimedia.dll $$QT_BUILD_TREE/src/imports/multimedia/qmldir
+ multimediaImport.path = $$QT_IMPORTS_BASE_DIR/Qt/multimedia
+ DEPLOYMENT += multimediaImport
+ }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems