summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetext.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-15 06:49:35 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-15 06:49:35 (GMT)
commit5783d51bcaed2a769c222ae7f6123f7638d6388a (patch)
treec672130f70e84bf788667c9389d1a2c7bc3d2b21 /src/declarative/graphicsitems/qdeclarativetext.cpp
parentb0830166fb28ad26257602b55e3158bb61a9d5cd (diff)
downloadQt-5783d51bcaed2a769c222ae7f6123f7638d6388a.zip
Qt-5783d51bcaed2a769c222ae7f6123f7638d6388a.tar.gz
Qt-5783d51bcaed2a769c222ae7f6123f7638d6388a.tar.bz2
Simplify dynamic resource loading to avoid cluttering Text API.
Task-number: QTBUG-9900 QT-3287
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetext.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 9fcfd92..a95c930 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -77,7 +77,7 @@ protected:
if (type == QTextDocument::ImageResource) {
QPixmap pm;
QString errorString;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(url, &pm, &errorString, 0, true, 0, 0);
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(url, &pm, &errorString, 0, false, 0, 0);
if (status == QDeclarativePixmapReply::Ready)
return pm;
if (status == QDeclarativePixmapReply::Error) {
@@ -89,7 +89,6 @@ protected:
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(parent()), url);
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
outstanding++;
- static_cast<QDeclarativeText*>(parent())->reloadWithResources();
}
}
@@ -100,7 +99,8 @@ private slots:
void requestFinished()
{
outstanding--;
- static_cast<QDeclarativeText*>(parent())->reloadWithResources();
+ if (outstanding == 0)
+ static_cast<QDeclarativeText*>(parent())->reloadWithResources();
}
private:
@@ -968,17 +968,13 @@ void QDeclarativeText::reloadWithResources()
Q_D(QDeclarativeText);
if (!d->richText)
return;
- if (resourcesLoading()!=0)
- return;
- emit resourcesLoadingChanged();
d->doc->setHtml(d->text);
d->updateLayout();
d->markImgDirty();
}
/*!
- \qmlproperty int Text::resourcesLoading
- This property is the number of resources (images) that are being loaded asynchronously.
+ Returns the number of resources (images) that are being loaded asynchronously.
*/
int QDeclarativeText::resourcesLoading() const
{
@@ -986,7 +982,6 @@ int QDeclarativeText::resourcesLoading() const
return d->doc ? d->doc->resourcesLoading() : 0;
}
-
void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeText);