diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-12-08 07:12:05 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-12-08 07:12:05 (GMT) |
commit | d2632f76183fc3c2d05e324575afa2654db03b76 (patch) | |
tree | f014f69f2bb8a77dacdb1c9616284c4ae9000d4a /src/declarative | |
parent | 05c6b333b8afbb44c3120142a17537aba27f88e3 (diff) | |
parent | 7cfbd79775692b3acc98cfd39d6a6384f3b59b89 (diff) | |
download | Qt-d2632f76183fc3c2d05e324575afa2654db03b76.zip Qt-d2632f76183fc3c2d05e324575afa2654db03b76.tar.gz Qt-d2632f76183fc3c2d05e324575afa2654db03b76.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsloader.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsrepeater.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstextedit.cpp | 3 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicswebview.cpp | 36 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicswebview_p.h | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompileddata.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 13 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlpropertycache.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlsqldatabase.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlworkerscript.cpp | 1 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 8 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation_p_p.h | 2 |
14 files changed, 67 insertions, 14 deletions
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/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp index 86239cf..bb1020c 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp @@ -263,6 +263,7 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded() QObject *obj = component->create(ctxt); if (obj) { + ctxt->setParent(obj); item = qobject_cast<QmlGraphicsItem *>(obj); if (item) { item->setParentItem(q); @@ -271,6 +272,7 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded() } } else { delete obj; + delete ctxt; source = QUrl(); } emit q->sourceChanged(); 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) diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 747e2fb..0b8bc83 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 >= 0x040601 // XXX see bug QT-2236 control->setIgnoreUnusedNavigationEvents(true); +#endif QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); 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<QObject *> @@ -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; 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/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index bd6d540..63d5b70 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -147,11 +147,18 @@ QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv) newQMetaObject(StaticQtMetaObject::get()); globalObject().setProperty(QLatin1String("Qt"), qtObject); - offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace('/', QDir::separator()) + offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator()) + QDir::separator() + QLatin1String("QML") + QDir::separator() + QLatin1String("OfflineStorage"); + + qt_add_qmlxmlhttprequest(this); qt_add_qmlsqldatabase(this); + // XXX A Multimedia "Qt.Sound" class also needs to be made available, + // XXX but we don't want a dependency in that cirection. + // XXX When the above a done some better way, that way should also be + // XXX used to add Qt.Sound class. + //types qtObject.setProperty(QLatin1String("rgba"), newFunction(QmlEnginePrivate::rgba, 4)); @@ -233,6 +240,8 @@ QmlEnginePrivate::~QmlEnginePrivate() typeNameClass = 0; delete listClass; listClass = 0; + delete globalClass; + globalClass = 0; for(int ii = 0; ii < bindValues.count(); ++ii) clear(bindValues[ii]); @@ -309,7 +318,7 @@ QmlWorkerScriptEngine *QmlEnginePrivate::getWorkerScriptEngine() \code QmlEngine engine; - QmlComponent component(&engine, "Text { text: \"Hello world!\" }"); + QmlComponent component(&engine, "import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(component.create()); //add item to view, etc diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index a1ea90d..9c7aff8 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -806,7 +806,7 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data if (value.userType() == QVariant::Double) { double integral; double fractional = modf(value.toDouble(), &integral); - if (qFuzzyCompare(fractional, (double)0.0)) + if (qFuzzyIsNull(fractional)) v.convert(QVariant::Int); } return writeEnumProperty(prop, coreIdx, object, v, flags); 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/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) 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.cpp b/src/declarative/util/qmlanimation.cpp index 8afe667..a4f67ac 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -2064,8 +2064,8 @@ void QmlPropertyAnimation::prepare(QmlMetaProperty &p) d->property = d->userProperty; if (!d->rangeIsSet) { - d->va->setStartValue(QVariant(0.0f)); - d->va->setEndValue(QVariant(1.0f)); + d->va->setStartValue(qreal(0)); + d->va->setEndValue(qreal(1)); d->rangeIsSet = true; } @@ -2227,8 +2227,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, if (data->actions.count()) { if (!d->rangeIsSet) { - d->va->setStartValue(QVariant(0.0f)); - d->va->setEndValue(QVariant(1.0f)); + d->va->setStartValue(qreal(0)); + d->va->setEndValue(qreal(1)); d->rangeIsSet = true; } d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped); 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) |