diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-07-28 06:00:08 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-07-28 06:00:08 (GMT) |
commit | 38ec21238a82b9c886cd38ff293b617c6e3970c2 (patch) | |
tree | f178549c6b96f315ddcff798776ee62e3a225553 /src | |
parent | 3a4c4ecb16827419fcb133744a7e97ed860cc669 (diff) | |
parent | 00daed26e5cc52729d00b235addfe08b766a9c73 (diff) | |
download | Qt-38ec21238a82b9c886cd38ff293b617c6e3970c2.zip Qt-38ec21238a82b9c886cd38ff293b617c6e3970c2.tar.gz Qt-38ec21238a82b9c886cd38ff293b617c6e3970c2.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.cpp | 17 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.h | 1 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 12 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponentjs.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 27 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlscript.cpp | 2 |
13 files changed, 21 insertions, 54 deletions
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 850082b..5a05f49 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -60,7 +60,7 @@ #include "QtCore/qvector.h" #include "QtCore/qreadwritelock.h" #include "QtCore/qvariant.h" -#include "qguard_p.h" +#include "private/qguard_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index a91ddc6..6ffe603 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -154,7 +154,7 @@ public: , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) - , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) + , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false) {} void init(); @@ -316,7 +316,6 @@ public: QmlFollow *highlightXAnimator; QmlFollow *highlightYAnimator; - int keyPressed : 1; int ownModel : 1; int wrap : 1; int autoHighlight : 1; @@ -1093,7 +1092,6 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Up) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Left)) { if (currentIndex() >= d->columns || d->wrap) { - d->keyPressed = true; d->moveReason = QFxGridViewPrivate::Key; int index = currentIndex() - d->columns; setCurrentIndex(index >= 0 ? index : d->model->count()-1); @@ -1103,7 +1101,6 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Down) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Right)) { if (currentIndex() < d->model->count() - d->columns || d->wrap) { - d->keyPressed = true; d->moveReason = QFxGridViewPrivate::Key; int index = currentIndex()+d->columns; setCurrentIndex(index < d->model->count() ? index : 0); @@ -1113,7 +1110,6 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Left) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || d->wrap) { - d->keyPressed = true; d->moveReason = QFxGridViewPrivate::Key; int index = currentIndex() - 1; setCurrentIndex(index >= 0 ? index : d->model->count()-1); @@ -1123,7 +1119,6 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Right) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || d->wrap) { - d->keyPressed = true; d->moveReason = QFxGridViewPrivate::Key; int index = currentIndex() + 1; setCurrentIndex(index < d->model->count() ? index : 0); @@ -1139,16 +1134,6 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) /*! \reimp */ -void QFxGridView::keyReleaseEvent(QKeyEvent *event) -{ - Q_D(QFxGridView); - d->keyPressed = false; - QFxFlickable::keyReleaseEvent(event); -} - -/*! - \reimp -*/ void QFxGridView::componentComplete() { Q_D(QFxGridView); diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 8f443e1..3708f19 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -123,7 +123,6 @@ protected: virtual qreal minXExtent() const; virtual qreal maxXExtent() const; virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); virtual void componentComplete(); private Q_SLOTS: diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 09ae22c..f8ed7b4 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -821,7 +821,7 @@ void QFxItem::qmlLoaded() QFxItem* ret = qobject_cast<QFxItem*>(o); if (ret) { ret->setItemParent(this); - QScriptValue v = QmlEngine::getScriptEngine(qmlEngine(this))->newQObject(ret); + QScriptValue v = QmlEnginePrivate::getScriptEngine(qmlEngine(this))->newQObject(ret); emit newChildCreated(d->_qmlnewloading.at(i).toString(),v); } diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index f300d1e..e563ecb 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -175,7 +175,7 @@ public: , averageSize(100), currentIndex(-1), requestedIndex(-1) , currItemMode(QFxListView::Free), snapPos(0), highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) - , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) + , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false) {} void init(); @@ -371,7 +371,6 @@ public: QString sectionExpression; QString currentSection; - int keyPressed : 1; int ownModel : 1; int wrap : 1; int autoHighlight : 1; @@ -1320,7 +1319,6 @@ void QFxListView::keyPressEvent(QKeyEvent *event) if ((d->orient == Qt::Horizontal && event->key() == Qt::Key_Left) || (d->orient == Qt::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || d->wrap) { - d->keyPressed = true; d->moveReason = QFxListViewPrivate::Key; int index = currentIndex()-1; d->updateCurrent(index >= 0 ? index : d->model->count()-1); @@ -1330,7 +1328,6 @@ void QFxListView::keyPressEvent(QKeyEvent *event) } else if ((d->orient == Qt::Horizontal && event->key() == Qt::Key_Right) || (d->orient == Qt::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || d->wrap) { - d->keyPressed = true; d->moveReason = QFxListViewPrivate::Key; int index = currentIndex()+1; d->updateCurrent(index < d->model->count() ? index : 0); @@ -1343,13 +1340,6 @@ void QFxListView::keyPressEvent(QKeyEvent *event) QFxFlickable::keyPressEvent(event); } -void QFxListView::keyReleaseEvent(QKeyEvent *event) -{ - Q_D(QFxListView); - d->keyPressed = false; - QFxFlickable::keyReleaseEvent(event); -} - void QFxListView::componentComplete() { Q_D(QFxListView); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 2a70af0..cd27050 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -131,7 +131,6 @@ protected: virtual qreal minXExtent() const; virtual qreal maxXExtent() const; virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); virtual void componentComplete(); private Q_SLOTS: diff --git a/src/declarative/qml/qmlcomponentjs.cpp b/src/declarative/qml/qmlcomponentjs.cpp index 2552f78..df3e834 100644 --- a/src/declarative/qml/qmlcomponentjs.cpp +++ b/src/declarative/qml/qmlcomponentjs.cpp @@ -84,7 +84,7 @@ QScriptValue QmlComponentJS::createObject() { Q_D(QmlComponentJS); QObject* ret = create(d->ctxt); - return QmlEngine::qmlScriptObject(ret, d->engine); + return QmlEnginePrivate::qmlScriptObject(ret, d->engine); } /*! diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index bf549d8..dabaa5e 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -106,7 +106,7 @@ void QmlContextPrivate::init() parent->d_func()->childContexts.insert(q); //set scope chain - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue scopeObj = scriptEngine->newObject(QmlEnginePrivate::get(engine)->contextClass, scriptEngine->newVariant(QVariant::fromValue((QObject*)q))); if (!parent) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 0016144..321feb9 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -520,13 +520,6 @@ void QmlInstanceDeclarativeData::destroyed(QObject *object) delete this; } -/*! A way to access the QScriptEngine, so that you can add your own objects. - This function is likely to be removed upon further reflection. -*/ -QScriptEngine *QmlEngine::getScriptEngine(QmlEngine *e) -{ - return &e->d_func()->scriptEngine; -} /*! \internal */ /* QScriptEngine *QmlEngine::scriptEngine() @@ -540,14 +533,14 @@ QScriptEngine *QmlEngine::scriptEngine() Creates a QScriptValue allowing you to use \a object in QML script. \a engine is the QmlEngine it is to be created in. - The QScriptValue returned is a Qml Script Object, not a QtScript QObject, - due to the special needs of QML requiring more functionality than a standard + The QScriptValue returned is a QtScript Object, not a QtScript QObject, due + to the special needs of QML requiring more functionality than a standard QtScript QObject. */ -QScriptValue QmlEngine::qmlScriptObject(QObject* object, +QScriptValue QmlEnginePrivate::qmlScriptObject(QObject* object, QmlEngine* engine) { - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); return scriptEngine->newObject(new QmlObjectScriptClass(engine), scriptEngine->newQObject(object)); } @@ -691,13 +684,13 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi if(obj) { obj->setParent(parentArg); obj->setProperty("parent", QVariant::fromValue<QObject*>(parentArg)); - return QmlEngine::qmlScriptObject(obj, activeEngine); + return qmlScriptObject(obj, activeEngine); } return engine->nullValue(); } QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) -: QScriptClass(QmlEngine::getScriptEngine(bindengine)), +: QScriptClass(QmlEnginePrivate::getScriptEngine(bindengine)), engine(bindengine) { } @@ -787,7 +780,7 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object, uint basicId = id & QmlScriptClass::ClassIdMask; - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); switch (basicId) { @@ -847,7 +840,7 @@ void QmlContextScriptClass::setProperty(QScriptValue &object, int objIdx = (id & QmlScriptClass::ClassIdSelectorMask) >> 24; QObject *obj = bindContext->d_func()->defaultObjects.at(objIdx); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue oldact = scriptEngine->currentContext()->activationObject(); scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); @@ -955,7 +948,7 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine) : QmlScriptClass(bindEngine) { engine = bindEngine; - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(bindEngine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(bindEngine); prototypeObject = scriptEngine->newObject(); prototypeObject.setProperty(QLatin1String("destroy"), scriptEngine->newFunction(QmlObjectDestroy)); @@ -1027,7 +1020,7 @@ void QmlObjectScriptClass::setProperty(QScriptValue &object, qWarning() << "Set QmlObject Property" << name.toString() << value.toVariant(); #endif - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue oldact = scriptEngine->currentContext()->activationObject(); scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index a3457f0..6066059 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -86,8 +86,6 @@ public: static QmlContext *contextForObject(const QObject *); static void setContextForObject(QObject *, QmlContext *); - static QScriptValue qmlScriptObject(QObject*, QmlEngine*); - static QScriptEngine *getScriptEngine(QmlEngine *e); private: Q_DECLARE_PRIVATE(QmlEngine) }; diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 7b459e9..18cdd83 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -193,9 +193,12 @@ public: bool resolveType(const Imports&, const QByteArray& type, QmlType** type_return, QUrl* url_return, ImportedNamespace** ns_return=0) const; void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type, QmlType** type_return, QUrl* url_return ) const; + + static QScriptValue qmlScriptObject(QObject*, QmlEngine*); static QScriptValue createComponent(QScriptContext*, QScriptEngine*); static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*); + static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; } static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); } }; diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 990722a..2c06efa 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -240,7 +240,7 @@ QVariant QmlExpressionPrivate::evalQtScript() if (me) ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount, me); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValueList oldScopeChain = scriptEngine->currentContext()->scopeChain(); diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index df05d8e..ca9aad5 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -185,7 +185,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptContext *currentContext = scriptEngine->currentContext(); QScriptValueList oldScopeChain = currentContext->scopeChain(); |