summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-13 05:46:33 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-13 05:46:33 (GMT)
commit047695e49afa1303d8d83c326bfeeaf01297fefe (patch)
tree4c05c843318ed11368bcd70ab5dcb620b926ef18 /src/declarative
parent409f60f0f6fd2c2bad6125d0463c812ba1b1180a (diff)
parent18b940539d0633f30ae055feedb48aeb15969814 (diff)
downloadQt-047695e49afa1303d8d83c326bfeeaf01297fefe.zip
Qt-047695e49afa1303d8d83c326bfeeaf01297fefe.tar.gz
Qt-047695e49afa1303d8d83c326bfeeaf01297fefe.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/declarative.pro6
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp28
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp30
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp38
-rw-r--r--src/declarative/qml/qdeclarativeinclude.cpp24
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp19
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp26
15 files changed, 173 insertions, 73 deletions
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 299ca06..1ad888b 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -2,7 +2,6 @@ TARGET = QtDeclarative
QPRO_PWD = $$PWD
QT = core gui script network
contains(QT_CONFIG, svg): QT += svg
-contains(QT_CONFIG, opengl): QT += opengl
DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
@@ -25,7 +24,10 @@ include(graphicsitems/graphicsitems.pri)
include(qml/qml.pri)
include(debugger/debugger.pri)
-symbian:TARGET.UID3=0x2001E623
+symbian: {
+ TARGET.UID3=0x2001E623
+ LIBS += -lefsrv
+}
DEFINES += QT_NO_OPENTYPE
INCLUDEPATH += ../3rdparty/harfbuzz/src
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 1615b0f..4a6a9dc 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -735,7 +735,7 @@ void QDeclarativeGridViewPrivate::createHighlight()
QDeclarative_setParent_noEvent(item, q->contentItem());
item->setParentItem(q->contentItem());
highlight = new FxGridItem(item, q);
- if (currentItem)
+ if (currentItem && autoHighlight)
highlight->setPosition(currentItem->colPos(), currentItem->rowPos());
highlightXAnimator = new QSmoothedAnimation(q);
highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x"));
@@ -1253,7 +1253,8 @@ void QDeclarativeGridView::setModel(const QVariant &model)
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -1321,7 +1322,8 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -2241,7 +2243,8 @@ void QDeclarativeGridView::componentComplete()
else
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -2649,7 +2652,8 @@ void QDeclarativeGridView::modelReset()
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index cf12688..4cf9b26 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1839,9 +1839,9 @@ void QDeclarativeItem::setClip(bool c)
/*!
\qmlproperty real Item::z
- Sets the stacking order of the item. By default the stacking order is 0.
+ Sets the stacking order of sibling items. By default the stacking order is 0.
- Items with a higher stacking value are drawn on top of items with a
+ Items with a higher stacking value are drawn on top of siblings with a
lower stacking order. Items with the same stacking value are drawn
bottom up in the order they appear. Items with a negative stacking
value are drawn under their parent's content.
@@ -2142,6 +2142,8 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
Margins apply to top, bottom, left, right, and fill anchors.
The \c anchors.margins property can be used to set all of the various margins at once, to the same value.
+ Note that margins are anchor-specific and are not applied if an item does not
+ use anchors.
Offsets apply for horizontal center, vertical center, and baseline anchors.
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 402554b..7e4d157 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -126,7 +126,7 @@ public:
widthValid(false), heightValid(false),
componentComplete(true), keepMouse(false),
smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
- mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
+ mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0), hadSubFocusItem(false)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
isDeclarativeItem = 1;
@@ -275,6 +275,8 @@ public:
qreal implicitWidth;
qreal implicitHeight;
+ bool hadSubFocusItem;
+
QPointF computeTransformOrigin() const;
virtual void setPosHelper(const QPointF &pos)
@@ -288,9 +290,11 @@ public:
// Reimplemented from QGraphicsItemPrivate
virtual void subFocusItemChange()
{
- if (flags & QGraphicsItem::ItemIsFocusScope || !parent)
- emit q_func()->activeFocusChanged(subFocusItem != 0);
+ bool hasSubFocusItem = subFocusItem != 0;
+ if (((flags & QGraphicsItem::ItemIsFocusScope) || !parent) && hasSubFocusItem != hadSubFocusItem)
+ emit q_func()->activeFocusChanged(hasSubFocusItem);
//see also QDeclarativeItemPrivate::focusChanged
+ hadSubFocusItem = hasSubFocusItem;
}
// Reimplemented from QGraphicsItemPrivate
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 845da79..d008f91 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -739,16 +739,20 @@ void QDeclarativeListViewPrivate::layout()
return;
}
if (!visibleItems.isEmpty()) {
- qreal oldEnd = visibleItems.last()->endPosition();
+ bool fixedCurrent = currentItem && visibleItems.first()->item == currentItem->item;
+ qreal sum = visibleItems.first()->size();
qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing;
for (int i=1; i < visibleItems.count(); ++i) {
FxListItem *item = visibleItems.at(i);
item->setPosition(pos);
pos += item->size() + spacing;
+ sum += item->size();
+ fixedCurrent = fixedCurrent || (currentItem && item->item == currentItem->item);
}
- // move current item if it is after the visible items.
- if (currentItem && currentIndex > lastVisibleIndex())
- currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd));
+ averageSize = qRound(sum / visibleItems.count());
+ // move current item if it is not a visible item.
+ if (currentIndex >= 0 && currentItem && !fixedCurrent)
+ currentItem->setPosition(positionAt(currentIndex));
}
q->refill();
minExtentDirty = true;
@@ -1567,7 +1571,8 @@ void QDeclarativeListView::setModel(const QVariant &model)
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
}
@@ -1638,7 +1643,8 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
}
@@ -2628,8 +2634,10 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
cancelFlick();
d->setPosition(pos);
if (d->highlight) {
- d->highlight->setPosition(d->currentItem->itemPosition());
- d->highlight->setSize(d->currentItem->itemSize());
+ if (d->autoHighlight) {
+ d->highlight->setPosition(d->currentItem->itemPosition());
+ d->highlight->setSize(d->currentItem->itemSize());
+ }
d->updateHighlight();
}
}
@@ -2675,7 +2683,8 @@ void QDeclarativeListView::componentComplete()
else
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeListViewPrivate::Other;
@@ -3138,7 +3147,8 @@ void QDeclarativeListView::modelReset()
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeListViewPrivate::Other;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 7c79afe..87ea214 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1478,7 +1478,7 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
currentChanged = true;
} else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) {
// current item has been removed.
- d->currentIndex = qMin(modelIndex, d->modelCount-1);
+ d->currentIndex = qMin(modelIndex, d->modelCount-count-1);
if (d->currentItem) {
if (QDeclarativePathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index dedb3f7..99b36a8 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -470,6 +470,8 @@ void QDeclarativeRectangle::generateBorderedRect()
void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeRectangle);
+ if (width() <= 0 || height() <= 0)
+ return;
if (d->radius > 0 || (d->pen && d->pen->isValid())
|| (d->gradient && d->gradient->gradient()) ) {
drawRect(*p);
@@ -539,6 +541,12 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
Q_ASSERT(d->rectImage.width() == 2*xOffset + 1);
Q_ASSERT(d->rectImage.height() == 2*yOffset + 1);
+ // check whether we've eliminated the center completely
+ if (2*xOffset > width()+pw)
+ xOffset = (width()+pw)/2;
+ if (2*yOffset > height()+pw)
+ yOffset = (height()+pw)/2;
+
QMargins margins(xOffset, yOffset, xOffset, yOffset);
QTileRules rules(Qt::StretchTile, Qt::StretchTile);
//NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 2fb7ace..4649be8 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -779,7 +779,7 @@ void QDeclarativeTextInput::setEchoMode(QDeclarativeTextInput::EchoMode echo)
imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
setInputMethodHints(imHints);
d->control->setEchoMode((uint)echo);
- update();
+ q_textChanged();
emit echoModeChanged(echoMode());
}
@@ -1487,6 +1487,7 @@ void QDeclarativeTextInput::cursorPosChanged()
updateRect();//TODO: Only update rect between pos's
updateMicroFocus();
emit cursorPositionChanged();
+ d->control->resetCursorBlinkTimer();
if(!d->control->hasSelectedText()){
if(d->lastSelectionStart != d->control->cursor()){
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 9900ff8..dd07067 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -1368,7 +1368,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent,
Q_D(QDeclarativeVisualDataModel);
const int count = sourceEnd - sourceStart + 1;
if (destinationParent == d->m_root && sourceParent == d->m_root) {
- _q_itemsMoved(sourceStart, destinationRow, count);
+ _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-1, count);
} else if (sourceParent == d->m_root) {
_q_itemsRemoved(sourceStart, count);
} else if (destinationParent == d->m_root) {
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index a72e04e..a8b1c3f 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -147,32 +147,36 @@ class QByteArray;
Components are reusable, encapsulated QML elements with well-defined interfaces.
Components are often defined by \l {qdeclarativedocuments.html}{component files} -
- that is, \c .qml files. The \e Component element allows components to be defined
- within QML items rather than in a separate file. This may be useful for reusing
- a small component within a QML file, or for defining a component that logically
- belongs with other QML components within a file.
+ that is, \c .qml files. The \e Component element essentially allows QML components
+ to be defined inline, within a \l {QML Document}{QML document}, rather than as a separate QML file.
+ This may be useful for reusing a small component within a QML file, or for defining
+ a component that logically belongs with other QML components within a file.
For example, here is a component that is used by multiple \l Loader objects.
- It contains a top level \l Rectangle item:
+ It contains a single item, a \l Rectangle:
\snippet doc/src/snippets/declarative/component.qml 0
Notice that while a \l Rectangle by itself would be automatically
rendered and displayed, this is not the case for the above rectangle
because it is defined inside a \c Component. The component encapsulates the
- QML elements within, as if they were defined in a separate \c .qml
+ QML elements within, as if they were defined in a separate QML
file, and is not loaded until requested (in this case, by the
two \l Loader objects).
- A Component cannot contain anything other
- than an \c id and a single top level item. While the \c id is optional,
- the top level item is not; you cannot define an empty component.
+ Defining a \c Component is similar to defining a \l {QML Document}{QML document}.
+ A QML document has a single top-level item that defines the behaviors and
+ properties of that component, and cannot define properties or behaviors outside
+ of that top-level item. In the same way, a \c Component definition contains a single
+ top level item (which in the above example is a \l Rectangle) and cannot define any
+ data outside of this item, with the exception of an \e id (which in the above example
+ is \e redSquare).
- The Component element is commonly used to provide graphical components
- for views. For example, the ListView::delegate property requires a Component
+ The \c Component element is commonly used to provide graphical components
+ for views. For example, the ListView::delegate property requires a \c Component
to specify how each list item is to be displayed.
- Component objects can also be dynamically created using
+ \c Component objects can also be created dynamically using
\l{QML:Qt::createComponent()}{Qt.createComponent()}.
*/
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 48bf3d1..3a5fe66 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -262,6 +262,33 @@ of their use.
\endlist
*/
+/*!
+\qmlmethod object Qt::include(string url, jsobject callback)
+
+Includes another JavaScript file. This method can only be used from within JavaScript files,
+and not regular QML files.
+
+This imports all functions from \a url into the current script's namespace.
+
+Qt.include() returns an object that describes the status of the operation. The object has
+a single property, \c {status}, that is set to one of the following values:
+
+\table
+\header \o Symbol \o Value \o Description
+\row \o result.OK \o 0 \o The include completed successfully.
+\row \o result.LOADING \o 1 \o Data is being loaded from the network.
+\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
+\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
+An additional \c exception property will be set in this case.
+\endtable
+
+The \c status property will be updated as the operation progresses.
+
+If provided, \a callback is invoked when the operation completes. The callback is passed
+the same object as is returned from the Qt.include() call.
+*/
+// Qt.include() is implemented in qdeclarativeinclude.cpp
+
QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), isDebugging(false),
@@ -679,6 +706,9 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const
requests. See the QDeclarativeImageProvider documentation for details on
implementing and using image providers.
+ All required image providers should be added to the engine before any
+ QML sources files are loaded.
+
Note that images loaded from a QDeclarativeImageProvider are cached
by QPixmapCache, similar to any image loaded by QML.
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 6f5216a..94765f2 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -51,6 +51,10 @@
#include <private/qdeclarativetypenamecache_p.h>
#include <private/qdeclarativeengine_p.h>
+#ifdef Q_OS_SYMBIAN
+#include "private/qcore_symbian_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
@@ -378,7 +382,13 @@ bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath
foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
QString resolvedFilePath = database->resolvePlugin(dir, plugin.path, plugin.name);
-
+#if defined(QT_LIBINFIX) && defined(Q_OS_SYMBIAN)
+ if (resolvedFilePath.isEmpty()) {
+ // In case of libinfixed build, attempt to load libinfixed version, too.
+ QString infixedPluginName = plugin.name + QLatin1String(QT_LIBINFIX);
+ resolvedFilePath = database->resolvePlugin(dir, plugin.path, infixedPluginName);
+ }
+#endif
if (!resolvedFilePath.isEmpty()) {
if (!database->importPlugin(resolvedFilePath, uri, errorString)) {
if (errorString)
@@ -658,8 +668,32 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
// Search order is applicationDirPath(), $QML_IMPORT_PATH, QLibraryInfo::ImportsPath
- addImportPath(QLibraryInfo::location(QLibraryInfo::ImportsPath));
+ QString installImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
+#if defined(Q_OS_SYMBIAN)
+ // Append imports path for all available drives in Symbian
+ if (installImportsPath.at(1) != QChar(QLatin1Char(':'))) {
+ QString tempPath = installImportsPath;
+ if (tempPath.at(tempPath.length() - 1) != QDir::separator()) {
+ tempPath += QDir::separator();
+ }
+ RFs& fs = qt_s60GetRFs();
+ TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ TFindFile finder(fs);
+ TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
+ while (err == KErrNone) {
+ QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
+ finder.File().Length());
+ foundDir = QDir(foundDir).canonicalPath();
+ addImportPath(foundDir);
+ err = finder.Find();
+ }
+ } else {
+ addImportPath(installImportsPath);
+ }
+#else
+ addImportPath(installImportsPath);
+#endif
// env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
if (!envImportPath.isEmpty()) {
diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp
index 1e240d7..a9ecdda 100644
--- a/src/declarative/qml/qdeclarativeinclude.cpp
+++ b/src/declarative/qml/qdeclarativeinclude.cpp
@@ -172,28 +172,8 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback
}
}
-/*!
-\qmlmethod object Qt::include(string url, jsobject callback)
-
-Include another JavaScript file. This method can only be used from within JavaScript files,
-and not regular QML files.
-
-Qt.include() returns an object that describes the status of the operation. The object has
-a single property, \c {status} that is set to one of the following values:
-
-\table
-\header \o Symbol \o Value \o Description
-\row \o result.OK \o 0 \o The include completed successfully.
-\row \o result.LOADING \o 1 \o Data is being loaded from the network.
-\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
-\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
-An additional \c exception property will be set in this case.
-\endtable
-
-The return object's properties will be updated as the operation progresses.
-
-If provided, \a callback is invoked when the operation completes. The callback is passed
-the same object as is returned from the Qt.include() call.
+/*
+ Documented in qdeclarativeengine.cpp
*/
QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine)
{
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index df0917f..60edd64 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -77,15 +77,28 @@ a property on a specific object instance. To read a property's value, programme
QDeclarativeProperty instance and call the read() method. Likewise to write a property value the
write() method is used.
+For example, for the following QML code:
+
+\qml
+// MyItem.qml
+import QtQuick 1.0
+
+Text { text: "A bit of text" }
+\endqml
+
+The \l Text object's properties could be accessed using QDeclarativeProperty, like this:
+
\code
+#include <QDeclarativeProperty>
+#include <QGraphicsObject>
-QObject *object = declarativeComponent.create();
+...
-QDeclarativeProperty property(object, "font.pixelSize");
+QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
+QDeclarativeProperty property(view.rootObject(), "font.pixelSize");
qWarning() << "Current pixel size:" << property.read().toInt();
property.write(24);
qWarning() << "Pixel size should now be 24:" << property.read().toInt();
-
\endcode
*/
diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 45f277e..bda02a5 100644
--- a/src/declarative/qml/qdeclarativesqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -172,16 +172,23 @@ static const char* sqlerror[] = {
return errorValue; \
}
-
-static QString databaseFile(const QString& connectionName, QScriptEngine *engine)
+static QString qmlsqldatabase_databasesPath(QScriptEngine *engine)
{
QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine);
- QString basename = qmlengine->offlineStoragePath
- + QDir::separator() + QLatin1String("Databases") + QDir::separator();
- basename += connectionName;
- return basename;
+ return qmlengine->offlineStoragePath
+ + QDir::separator() + QLatin1String("Databases");
}
+static void qmlsqldatabase_initDatabasesPath(QScriptEngine *engine)
+{
+ QDir().mkpath(qmlsqldatabase_databasesPath(engine));
+}
+
+static QString qmlsqldatabase_databaseFile(const QString& connectionName, QScriptEngine *engine)
+{
+ return qmlsqldatabase_databasesPath(engine) + QDir::separator()
+ + connectionName;
+}
static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *engine)
@@ -302,7 +309,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri
if (ok) {
context->thisObject().setProperty(QLatin1String("version"), to_version, QScriptValue::ReadOnly);
- QSettings ini(databaseFile(db.connectionName(),engine)+QLatin1String(".ini"),QSettings::IniFormat);
+ QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(),engine) + QLatin1String(".ini"), QSettings::IniFormat);
ini.setValue(QLatin1String("Version"), to_version);
}
@@ -348,6 +355,8 @@ static QScriptValue qmlsqldatabase_read_transaction(QScriptContext *context, QSc
*/
static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEngine *engine)
{
+ qmlsqldatabase_initDatabasesPath(engine);
+
QSqlDatabase database;
QString dbname = context->argument(0).toString();
@@ -360,7 +369,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
md5.addData(dbname.toUtf8());
QString dbid(QLatin1String(md5.result().toHex()));
- QString basename = databaseFile(dbid,engine);
+ QString basename = qmlsqldatabase_databaseFile(dbid, engine);
bool created = false;
QString version = dbversion;
@@ -375,7 +384,6 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
} else {
created = !QFile::exists(basename+QLatin1String(".sqlite"));
database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
- QDir().mkpath(basename);
if (created) {
ini.setValue(QLatin1String("Name"), dbname);
if (dbcreationCallback.isFunction())