summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-24 03:39:38 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-24 03:39:38 (GMT)
commitfb5fc5eead19a079853ebc3b0f8eddd94bbc0154 (patch)
tree8aec4d1a03e199a8c0f8cc7b9cecf91a098630fd /src
parente5722f539888913b9bea4f91db95f5e2c5fceed1 (diff)
parent52b3d6263bb58ca82a8f00d42af801f5ed521f6b (diff)
downloadQt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.zip
Qt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.tar.gz
Qt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Update lupdate to recognize concatenated text in QML files. Ensure sourcesize is in pixmap cache key. Use ugly but reliable bitmaps fonts in test. doc: note that calling methods before component completion may have no effect Fix unstable qdeclarativeviewer tests Use Pen with Qt::MiterJoin when drawing Rectangles with gradients Update screenshot Fix and better test Text / TextEdit alignments. Ensure the view is correctly positioned at component complete. Support for non-literal plural arguments to qsTr() in lupdate (QML). References to undefined variables throws a ReferenceError
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp27
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp142
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp28
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp24
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass_p.h5
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp6
12 files changed, 193 insertions, 74 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 3792595..14980a8 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1919,6 +1919,8 @@ void QDeclarativeGridView::keyPressEvent(QKeyEvent *event)
Move the currentIndex up one item in the view.
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeGridView::moveCurrentIndexUp()
{
@@ -1942,6 +1944,8 @@ void QDeclarativeGridView::moveCurrentIndexUp()
Move the currentIndex down one item in the view.
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeGridView::moveCurrentIndexDown()
{
@@ -1965,6 +1969,8 @@ void QDeclarativeGridView::moveCurrentIndexDown()
Move the currentIndex left one item in the view.
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeGridView::moveCurrentIndexLeft()
{
@@ -1988,6 +1994,8 @@ void QDeclarativeGridView::moveCurrentIndexLeft()
Move the currentIndex right one item in the view.
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeGridView::moveCurrentIndexRight()
{
@@ -2028,6 +2036,14 @@ void QDeclarativeGridView::moveCurrentIndexRight()
at a particular index. This is unreliable since removing items from the start
of the view does not cause all other items to be repositioned.
The correct way to bring an item into view is with \c positionViewAtIndex.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end:
+
+ \code
+ Component.onCompleted: positionViewAtIndex(count - 1, GridView.Beginning)
+ \endcode
*/
void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
{
@@ -2037,6 +2053,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
if (mode < Beginning || mode > Contain)
return;
+ if (d->layoutScheduled)
+ d->layout();
qreal pos = d->position();
FxGridItem *item = d->visibleItem(index);
if (!item) {
@@ -2079,6 +2097,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
pos = qMin(pos, maxExtent);
qreal minExtent = d->flow == QDeclarativeGridView::LeftToRight ? -minYExtent() : -minXExtent();
pos = qMax(pos, minExtent);
+ d->moveReason = QDeclarativeGridViewPrivate::Other;
+ cancelFlick();
d->setPosition(pos);
}
d->fixupPosition();
@@ -2093,6 +2113,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
If the item is outside the visible area, -1 is returned, regardless of
whether an item will exist at that point when scrolled into view.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
int QDeclarativeGridView::indexAt(int x, int y) const
{
@@ -2113,10 +2135,15 @@ void QDeclarativeGridView::componentComplete()
d->updateGrid();
if (d->isValid()) {
refill();
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
if (d->currentIndex < 0)
d->updateCurrent(0);
else
d->updateCurrent(d->currentIndex);
+ if (d->highlight) {
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ d->updateTrackedItem();
+ }
d->fixupPosition();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 06a3239..35794c2 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -2386,6 +2386,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
Increments the current index. The current index will wrap
if keyNavigationWraps is true and it is currently at the end.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeListView::incrementCurrentIndex()
{
@@ -2403,6 +2405,8 @@ void QDeclarativeListView::incrementCurrentIndex()
Decrements the current index. The current index will wrap
if keyNavigationWraps is true and it is currently at the beginning.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativeListView::decrementCurrentIndex()
{
@@ -2439,6 +2443,14 @@ void QDeclarativeListView::decrementCurrentIndex()
of the list does not cause all other items to be repositioned, and because
the actual start of the view can vary based on the size of the delegates.
The correct way to bring an item into view is with \c positionViewAtIndex.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end:
+
+ \code
+ Component.onCompleted: positionViewAtIndex(count - 1, ListView.Beginning)
+ \endcode
*/
void QDeclarativeListView::positionViewAtIndex(int index, int mode)
{
@@ -2448,6 +2460,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
if (mode < Beginning || mode > Contain)
return;
+ if (d->layoutScheduled)
+ d->layout();
qreal pos = d->position();
FxListItem *item = d->visibleItem(index);
if (!item) {
@@ -2491,6 +2505,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
pos = qMin(pos, maxExtent);
qreal minExtent = d->orient == QDeclarativeListView::Vertical ? -minYExtent() : -minXExtent();
pos = qMax(pos, minExtent);
+ d->moveReason = QDeclarativeListViewPrivate::Other;
+ cancelFlick();
d->setPosition(pos);
}
d->fixupPosition();
@@ -2505,6 +2521,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
If the item is outside the visible area, -1 is returned, regardless of
whether an item will exist at that point when scrolled into view.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
int QDeclarativeListView::indexAt(int x, int y) const
{
@@ -2529,6 +2547,10 @@ void QDeclarativeListView::componentComplete()
d->updateCurrent(0);
else
d->updateCurrent(d->currentIndex);
+ if (d->highlight) {
+ d->highlight->setPosition(d->currentItem->position());
+ d->updateTrackedItem();
+ }
d->fixupPosition();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index 13d1b61..3b9b8df 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -151,6 +151,7 @@ void QDeclarativePaintedItem::setContentsSize(const QSize &size)
{
Q_D(QDeclarativePaintedItem);
if (d->contentsSize == size) return;
+ prepareGeometryChange();
d->contentsSize = size;
clearCache();
update();
@@ -247,8 +248,7 @@ QRectF QDeclarativePaintedItem::boundingRect() const
void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativePaintedItem);
- const QRect content(0,0,qCeil(d->contentsSize.width()*d->contentsScale),
- qCeil(d->contentsSize.height()*d->contentsScale));
+ const QRect content = boundingRect().toRect();
if (content.width() <= 0 || content.height() <= 0)
return;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 0c2d249..0e980b3 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -552,6 +552,8 @@ void QDeclarativePathView::setCurrentIndex(int idx)
\qmlmethod PathView::incrementCurrentIndex()
Increments the current index.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativePathView::incrementCurrentIndex()
{
@@ -563,6 +565,8 @@ void QDeclarativePathView::incrementCurrentIndex()
\qmlmethod PathView::decrementCurrentIndex()
Decrements the current index.
+
+ \bold Note: methods should only be called after the Component has completed.
*/
void QDeclarativePathView::decrementCurrentIndex()
{
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 2756877..c49be46 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -446,6 +446,7 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
p.setRenderHint(QPainter::Antialiasing);
if (d->pen && d->pen->isValid()) {
QPen pn(QColor(d->pen->color()), d->pen->width());
+ pn.setJoinStyle(Qt::MiterJoin);
p.setPen(pn);
} else {
p.setPen(Qt::NoPen);
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index c2e0d67..2ba680d 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -663,6 +663,71 @@ void QDeclarativeText::setElideMode(QDeclarativeText::TextElideMode mode)
emit elideModeChanged(d->elideMode);
}
+QRectF QDeclarativeText::boundingRect() const
+{
+ Q_D(const QDeclarativeText);
+
+ int w = width();
+ int h = height();
+
+ int x = 0;
+ int y = 0;
+
+ if (d->cache || d->style != Normal) {
+ switch (d->hAlign) {
+ case AlignLeft:
+ x = 0;
+ break;
+ case AlignRight:
+ x = w - d->imgCache.width();
+ break;
+ case AlignHCenter:
+ x = (w - d->imgCache.width()) / 2;
+ break;
+ }
+
+ switch (d->vAlign) {
+ case AlignTop:
+ y = 0;
+ break;
+ case AlignBottom:
+ y = h - d->imgCache.height();
+ break;
+ case AlignVCenter:
+ y = (h - d->imgCache.height()) / 2;
+ break;
+ }
+
+ return QRectF(x,y,d->imgCache.width(),d->imgCache.height());
+ } else {
+ switch (d->hAlign) {
+ case AlignLeft:
+ x = 0;
+ break;
+ case AlignRight:
+ x = w - d->cachedLayoutSize.width();
+ break;
+ case AlignHCenter:
+ x = (w - d->cachedLayoutSize.width()) / 2;
+ break;
+ }
+
+ switch (d->vAlign) {
+ case AlignTop:
+ y = 0;
+ break;
+ case AlignBottom:
+ y = h - d->cachedLayoutSize.height();
+ break;
+ case AlignVCenter:
+ y = (h - d->cachedLayoutSize.height()) / 2;
+ break;
+ }
+
+ return QRectF(x,y,d->cachedLayoutSize.width(),d->cachedLayoutSize.height());
+ }
+}
+
void QDeclarativeText::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
@@ -713,6 +778,7 @@ void QDeclarativeTextPrivate::updateLayout()
}
}
+
void QDeclarativeTextPrivate::updateSize()
{
Q_Q(QDeclarativeText);
@@ -730,7 +796,10 @@ void QDeclarativeTextPrivate::updateSize()
//setup instance of QTextLayout for all cases other than richtext
if (!richText) {
size = setupTextLayout(&layout);
- cachedLayoutSize = size;
+ if (cachedLayoutSize != size) {
+ q->prepareGeometryChange();
+ cachedLayoutSize = size;
+ }
dy -= size.height();
} else {
singleline = false; // richtext can't elide or be optimized for single-line case
@@ -744,7 +813,13 @@ void QDeclarativeTextPrivate::updateSize()
else
doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug)
dy -= (int)doc->size().height();
- cachedLayoutSize = doc->size().toSize();
+ q->prepareGeometryChange();
+ QSize dsize = doc->size().toSize();
+ if (dsize != cachedLayoutSize) {
+ q->prepareGeometryChange();
+ cachedLayoutSize = dsize;
+ }
+ size = QSize(int(doc->idealWidth()),dsize.height());
}
int yoff = 0;
@@ -757,8 +832,8 @@ void QDeclarativeTextPrivate::updateSize()
q->setBaselineOffset(fm.ascent() + yoff);
//### need to comfirm cost of always setting these for richText
- q->setImplicitWidth(richText ? (int)doc->idealWidth() : size.width());
- q->setImplicitHeight(richText ? (int)doc->size().height() : size.height());
+ q->setImplicitWidth(size.width());
+ q->setImplicitHeight(size.height());
emit q->paintedSizeChanged();
} else {
dirty = true;
@@ -813,6 +888,8 @@ void QDeclarativeTextPrivate::drawOutline()
ppm.drawPixmap(pos, imgCache);
ppm.end();
+ if (imgCache.size() != img.size())
+ q_func()->prepareGeometryChange();
imgCache = img;
}
@@ -831,6 +908,8 @@ void QDeclarativeTextPrivate::drawOutline(int yOffset)
ppm.drawPixmap(pos, imgCache);
ppm.end();
+ if (imgCache.size() != img.size())
+ q_func()->prepareGeometryChange();
imgCache = img;
}
@@ -955,18 +1034,21 @@ void QDeclarativeTextPrivate::checkImgCache()
return;
bool empty = text.isEmpty();
+ QPixmap newImgCache;
if (empty) {
- imgCache = QPixmap();
imgStyleCache = QPixmap();
} else if (richText) {
- imgCache = richTextImage(false);
+ newImgCache = richTextImage(false);
if (style != QDeclarativeText::Normal)
imgStyleCache = richTextImage(true); //### should use styleColor
} else {
- imgCache = wrappedTextImage(false);
+ newImgCache = wrappedTextImage(false);
if (style != QDeclarativeText::Normal)
imgStyleCache = wrappedTextImage(true); //### should use styleColor
}
+ if (imgCache.size() != newImgCache.size())
+ q_func()->prepareGeometryChange();
+ imgCache = newImgCache;
if (!empty)
switch (style) {
case QDeclarativeText::Outline:
@@ -1031,35 +1113,7 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
if (d->smooth)
p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth);
- int w = width();
- int h = height();
-
- int x = 0;
- int y = 0;
-
- switch (d->hAlign) {
- case AlignLeft:
- x = 0;
- break;
- case AlignRight:
- x = w - d->imgCache.width();
- break;
- case AlignHCenter:
- x = (w - d->imgCache.width()) / 2;
- break;
- }
-
- switch (d->vAlign) {
- case AlignTop:
- y = 0;
- break;
- case AlignBottom:
- y = h - d->imgCache.height();
- break;
- case AlignVCenter:
- y = (h - d->imgCache.height()) / 2;
- break;
- }
+ QRect br = boundingRect().toRect();
bool needClip = clip() && (d->imgCache.width() > width() ||
d->imgCache.height() > height());
@@ -1068,7 +1122,7 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
p->save();
p->setClipRect(boundingRect(), Qt::IntersectClip);
}
- p->drawPixmap(x, y, d->imgCache);
+ p->drawPixmap(br.x(), br.y(), d->imgCache);
if (needClip)
p->restore();
@@ -1077,20 +1131,8 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth);
}
} else {
- int h = height();
- int y = 0;
+ qreal y = boundingRect().y();
- switch (d->vAlign) {
- case AlignTop:
- y = 0;
- break;
- case AlignBottom:
- y = h - d->cachedLayoutSize.height();
- break;
- case AlignVCenter:
- y = (h - d->cachedLayoutSize.height()) / 2;
- break;
- }
bool needClip = !clip() && (d->cachedLayoutSize.width() > width() ||
d->cachedLayoutSize.height() > height());
diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
index db21140..cd97df3 100644
--- a/src/declarative/graphicsitems/qdeclarativetext_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
@@ -143,6 +143,8 @@ public:
qreal paintedWidth() const;
qreal paintedHeight() const;
+ QRectF boundingRect() const;
+
Q_SIGNALS:
void textChanged(const QString &text);
void linkActivated(const QString &link);
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 3106daf..7db21f2 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -1231,8 +1231,13 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &rf)
r = QRect(0,0,INT_MAX,INT_MAX);
} else {
r = rf.toRect();
- if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything"
+ if (r.height() > INT_MAX/2) {
+ // Take care of overflow when translating "everything"
+ r.setTop(r.y() + d->yoff);
+ r.setBottom(INT_MAX/2);
+ } else {
r = r.translated(0,d->yoff);
+ }
}
dirtyCache(r);
emit update();
@@ -1327,6 +1332,14 @@ void QDeclarativeTextEdit::updateSelectionMarkers()
}
}
+QRectF QDeclarativeTextEdit::boundingRect() const
+{
+ Q_D(const QDeclarativeTextEdit);
+ QRectF r = QDeclarativePaintedItem::boundingRect();
+ return r.translated(0,d->yoff);
+}
+
+
//### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't
// need to do all the calculations each time
void QDeclarativeTextEdit::updateSize()
@@ -1341,13 +1354,20 @@ void QDeclarativeTextEdit::updateSize()
d->document->setTextWidth(width());
dy -= (int)d->document->size().height();
+ int nyoff;
if (heightValid()) {
if (d->vAlign == AlignBottom)
- d->yoff = dy;
+ nyoff = dy;
else if (d->vAlign == AlignVCenter)
- d->yoff = dy/2;
+ nyoff = dy/2;
+ else
+ nyoff = 0;
} else {
- d->yoff = 0;
+ nyoff = 0;
+ }
+ if (nyoff != d->yoff) {
+ prepareGeometryChange();
+ d->yoff = nyoff;
}
setBaselineOffset(fm.ascent() + d->yoff + d->textMargin);
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index d08f607..a6dd4a4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -195,6 +195,8 @@ public:
Q_INVOKABLE int positionAt(int x, int y) const;
Q_INVOKABLE void moveCursorSelection(int pos);
+ QRectF boundingRect() const;
+
Q_SIGNALS:
void textChanged(const QString &);
void paintedSizeChanged();
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index 6e107fb..f29b3f4 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -41,6 +41,7 @@
#include "private/qdeclarativeglobalscriptclass_p.h"
+#include <QtCore/qstringlist.h>
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptengine.h>
#include <QtScript/qscriptvalueiterator.h>
@@ -87,18 +88,7 @@ QDeclarativeGlobalScriptClass::queryProperty(const QScriptValue &object,
Q_UNUSED(name);
Q_UNUSED(flags);
Q_UNUSED(id);
- return HandlesReadAccess | HandlesWriteAccess;
-}
-
-QScriptValue
-QDeclarativeGlobalScriptClass::property(const QScriptValue &object,
- const QScriptString &name,
- uint id)
-{
- Q_UNUSED(object);
- Q_UNUSED(name);
- Q_UNUSED(id);
- return engine()->undefinedValue();
+ return HandlesWriteAccess;
}
void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object,
@@ -114,8 +104,9 @@ void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object,
}
/* This method is for the use of tst_qdeclarativeecmascript::callQtInvokables() only */
-void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value)
+void QDeclarativeGlobalScriptClass::explicitSetProperty(const QStringList &names, const QList<QScriptValue> &values)
{
+ Q_ASSERT(names.count() == values.count());
QScriptValue globalObject = engine()->globalObject();
QScriptValue v = engine()->newObject();
@@ -126,7 +117,12 @@ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, con
v.setProperty(iter.scriptName(), iter.value());
}
- v.setProperty(name, value);
+ for (int ii = 0; ii < names.count(); ++ii) {
+ const QString &name = names.at(ii);
+ const QScriptValue &value = values.at(ii);
+ v.setProperty(name, value);
+ }
+
v.setScriptClass(this);
engine()->setGlobalObject(v);
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
index 7690edd..fb44e5d 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
@@ -67,13 +67,10 @@ public:
const QScriptString &name,
QueryFlags flags, uint *id);
- virtual QScriptValue property(const QScriptValue &object,
- const QScriptString &name, uint id);
-
virtual void setProperty(QScriptValue &object, const QScriptString &name,
uint id, const QScriptValue &value);
- void explicitSetProperty(const QString &, const QScriptValue &);
+ void explicitSetProperty(const QStringList &, const QList<QScriptValue> &);
const QScriptValue &globalObject() const { return m_globalObject; }
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index a4ddf46..0a14462 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -510,6 +510,12 @@ bool QDeclarativePixmapReply::event(QEvent *event)
else
d->errorString = de->errorString;
QByteArray key = d->url.toEncoded(QUrl::FormattingOption(0x100));
+ if (d->forced_width > 0 || d->forced_height > 0) {
+ key += ':';
+ key += QByteArray::number(d->forced_width);
+ key += 'x';
+ key += QByteArray::number(d->forced_height);
+ }
QString strKey = QString::fromLatin1(key.constData(), key.count());
QPixmapCache::insert(strKey, d->pixmap); // note: may fail (returns false)
emit finished();