From 614faf7ac155ad3baef7ef62526f9ce4b2cc1e5a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 7 Dec 2009 17:39:19 +1000 Subject: Missed file --- .../declarative/qmlecmascript/data/exceptionProducesWarning.qml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml new file mode 100644 index 0000000..44722a9 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml @@ -0,0 +1,8 @@ +import Qt 4.6 +import Qt.test 1.0 + +MyQmlObject { + Component.onCompleted: + { throw(123,"JS exception") } +} + -- cgit v0.12 From 3e1b7110c1161b740c32ed0ee390f7030e8208ed Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 15:11:23 +1000 Subject: Fix leaks. --- src/declarative/graphicsitems/qmlgraphicslistview.cpp | 2 ++ src/declarative/qml/qmlcompileddata.cpp | 3 +++ src/declarative/qml/qmlpropertycache.cpp | 1 - src/declarative/qml/qmlworkerscript.cpp | 1 + src/declarative/util/qmlanimation_p_p.h | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 7fb6454..135262c 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -1256,6 +1256,8 @@ QmlGraphicsListView::~QmlGraphicsListView() d->clear(); if (d->ownModel) delete d->model; + delete d->header; + delete d->footer; } /*! diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index 8b165c6..198b574 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -176,6 +176,9 @@ QmlCompiledData::~QmlCompiledData() for (int ii = 0; ii < propertyCaches.count(); ++ii) propertyCaches.at(ii)->release(); + for (int ii = 0; ii < contextCaches.count(); ++ii) + contextCaches.at(ii)->release(); + if (importCache) importCache->release(); diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 7e3a1c4..bad8ad8 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -198,7 +198,6 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject cache->stringCache.insert(methodName, data); cache->identifierCache.insert(data->identifier.identifier, data); data->addref(); - data->addref(); } return cache; diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp index 5c281bb..a0d6ef0 100644 --- a/src/declarative/qml/qmlworkerscript.cpp +++ b/src/declarative/qml/qmlworkerscript.cpp @@ -389,6 +389,7 @@ QmlWorkerScriptEngine::QmlWorkerScriptEngine(QObject *parent) QmlWorkerScriptEngine::~QmlWorkerScriptEngine() { + qDeleteAll(d->workers); delete d; d = 0; } diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index fbd7114..2f911b4 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -102,6 +102,7 @@ public: QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped), running(false) {} QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped), running(false) {} + ~QActionAnimation() { if (policy == DeleteWhenStopped) { delete animAction; animAction = 0; } } virtual int duration() const { return 0; } void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) { @@ -145,6 +146,7 @@ class QmlTimeLineValueAnimator : public QVariantAnimation Q_OBJECT public: QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + ~QmlTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) { if (state() == Running) -- cgit v0.12 From cb745eacdb1c1e009f7f115d88dd03bdb9c16180 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 15:37:49 +1000 Subject: Use QApplication::startDragDistance() instead of pressDragLength Make pressTime settable (especially useful to turn it off). --- .../graphicsitems/qmlgraphicswebview.cpp | 36 +++++++++++++++++++--- .../graphicsitems/qmlgraphicswebview_p.h | 5 +++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 1fdf557..85fd0d7 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -103,8 +103,7 @@ public: QBasicTimer pressTimer; QPoint pressPoint; - int pressTime; // milliseconds before it's a "hold" XXX not currently settable - static const int pressDragLength = 15; // XXX #pixels before it's no longer a "hold"; device-specific + int pressTime; // milliseconds before it's a "hold" void updateWindowObjects(); class WindowObjectList : public QmlConcreteList @@ -612,6 +611,28 @@ bool QmlGraphicsWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) } } +/*! + \qmlproperty int WebView::pressGrabTime + + The number of milliseconds the user must press before the WebView + starts passing move events through to the web engine (rather than + letting other QML elements such as a Flickable take them). + + Defaults to 400ms. Set to 0 to always grab and pass move events to + the web engine. +*/ +int QmlGraphicsWebView::pressGrabTime() const +{ + Q_D(const QmlGraphicsWebView); + return d->pressTime; +} + +void QmlGraphicsWebView::setPressGrabTime(int ms) +{ + Q_D(QmlGraphicsWebView); + d->pressTime = ms; +} + void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QmlGraphicsWebView); @@ -620,8 +641,13 @@ void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) QMouseEvent *me = sceneMouseEventToMouseEvent(event); d->pressPoint = me->pos(); - d->pressTimer.start(d->pressTime,this); - setKeepMouseGrab(false); + if (d->pressTime) { + d->pressTimer.start(d->pressTime,this); + setKeepMouseGrab(false); + } else { + grabMouse(); + setKeepMouseGrab(true); + } page()->event(me); event->setAccepted( @@ -684,7 +710,7 @@ void QmlGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QMouseEvent *me = sceneMouseEventToMouseEvent(event); if (d->pressTimer.isActive()) { - if ((me->pos() - d->pressPoint).manhattanLength() > d->pressDragLength) { + if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { d->pressTimer.stop(); } } diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index 0b2ba07..f5edb7a 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -99,6 +99,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(QString html READ html WRITE setHtml) + Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime) + Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) @@ -135,6 +137,9 @@ public: Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; + int pressGrabTime() const; + void setPressGrabTime(int); + int preferredWidth() const; void setPreferredWidth(int); int preferredHeight() const; -- cgit v0.12 From 06d949102aa44ab4764f97cdb606b02d3dfe04c9 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 15:47:50 +1000 Subject: Compile with 4.6.x --- src/declarative/graphicsitems/qmlgraphicstextedit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 747e2fb..4bd3a49 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp @@ -871,7 +871,10 @@ void QmlGraphicsTextEditPrivate::init() q->setFlag(QGraphicsItem::ItemAcceptsInputMethod); control = new QTextControl(q); + +#if QT_VERSION >= 0x040700 // XXX see bug QT-2236 control->setIgnoreUnusedNavigationEvents(true); +#endif QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); -- cgit v0.12 From 8bbe541a602f5bea707bb5e042f9399e5bcd0b15 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 15:58:07 +1000 Subject: Remove debug. --- src/declarative/qml/qmlsqldatabase.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 6ddd5e5..c3c3ca3 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -409,7 +409,6 @@ void qt_add_qmlsqldatabase(QScriptEngine *engine) { QScriptValue openDatabase = engine->newFunction(qmlsqldatabase_open_sync, 4); engine->globalObject().setProperty(QLatin1String("openDatabaseSync"), openDatabase); -qDebug() << "qt_add_qmlsqldatabase" << engine; QScriptValue sqlExceptionPrototype = engine->newObject(); for (int i=0; sqlerror[i]; ++i) -- cgit v0.12 From abef2069a4f1afbbf373ec0b667838dadd926798 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 16:00:34 +1000 Subject: Fix leak. --- src/declarative/graphicsitems/qmlgraphicsrepeater.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp index a650999..99f0faa 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp @@ -56,6 +56,8 @@ QmlGraphicsRepeaterPrivate::QmlGraphicsRepeaterPrivate() QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate() { + if (ownModel) + delete model; } QML_DEFINE_TYPE(Qt,4,6,Repeater,QmlGraphicsRepeater) -- cgit v0.12