summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp5
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp34
-rw-r--r--src/declarative/fx/qfxblendedimage.h14
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp12
-rw-r--r--src/declarative/fx/qfxhighlightfilter.h8
-rw-r--r--src/declarative/fx/qfximage.cpp15
-rw-r--r--src/declarative/fx/qfximage.h8
-rw-r--r--src/declarative/fx/qfximage_p.h1
-rw-r--r--src/declarative/fx/qfxitem.cpp21
-rw-r--r--src/declarative/fx/qfxitem.h6
-rw-r--r--src/declarative/fx/qfxitem_p.h3
-rw-r--r--src/declarative/fx/qfxparticles.cpp18
-rw-r--r--src/declarative/fx/qfxparticles.h6
-rw-r--r--src/declarative/fx/qfxwebview.cpp18
-rw-r--r--src/declarative/fx/qfxwebview.h6
15 files changed, 82 insertions, 93 deletions
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index 029206b..604481c 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -155,7 +155,7 @@ int QFxAnimatedImageItem::frameCount() const
void QFxAnimatedImageItem::setSource(const QString &url)
{
Q_D(QFxAnimatedImageItem);
- if (url == d->source)
+ if (url == d->url)
return;
delete d->_movie;
@@ -166,8 +166,7 @@ void QFxAnimatedImageItem::setSource(const QString &url)
d->reply = 0;
}
- d->source = url;
- d->url = qmlContext(this)->resolvedUrl(url);
+ d->url = url;
if (url.isEmpty()) {
delete d->_movie;
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
index 4c6eb58..1f805df 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/fx/qfxblendedimage.cpp
@@ -84,9 +84,9 @@ QFxBlendedImage::QFxBlendedImage(QFxItem *parent)
\qmlproperty string BlendedImage::primaryUrl
The URL of the first image to be displayed in this item.
*/
-QString QFxBlendedImage::primaryUrl() const
+QUrl QFxBlendedImage::primaryUrl() const
{
- return primSrc;
+ return primUrl;
}
void QFxBlendedImage::primaryLoaded()
@@ -96,15 +96,15 @@ void QFxBlendedImage::primaryLoaded()
update();
}
-void QFxBlendedImage::setPrimaryUrl(const QString &url)
+void QFxBlendedImage::setPrimaryUrl(const QUrl &url)
{
- if (primSrc == url)
+ if (primUrl == url)
return;
- if (!primSrc.isEmpty())
+ if (!primUrl.isEmpty())
QFxPixmap::cancelGet(primUrl,this);
- primSrc = url;
- primUrl = qmlContext(this)->resolvedUrl(url);
- if (!primSrc.isEmpty())
+ Q_ASSERT(!primUrl.isRelative());
+ primUrl = url;
+ if (!primUrl.isEmpty())
QFxPixmap::get(qmlEngine(this), primUrl,this,SLOT(primaryLoaded()));
}
@@ -112,9 +112,9 @@ void QFxBlendedImage::setPrimaryUrl(const QString &url)
\qmlproperty string BlendedImage::secondaryUrl
The URL of the second image to be displayed in this item.
*/
-QString QFxBlendedImage::secondaryUrl() const
+QUrl QFxBlendedImage::secondaryUrl() const
{
- return secSrc;
+ return secUrl;
}
void QFxBlendedImage::secondaryLoaded()
@@ -124,15 +124,15 @@ void QFxBlendedImage::secondaryLoaded()
update();
}
-void QFxBlendedImage::setSecondaryUrl(const QString &url)
+void QFxBlendedImage::setSecondaryUrl(const QUrl &url)
{
- if (secSrc == url)
+ if (secUrl == url)
return;
- if (!secSrc.isEmpty())
+ if (!secUrl.isEmpty())
QFxPixmap::cancelGet(secUrl,this);
- secSrc = url;
- secUrl = qmlContext(this)->resolvedUrl(url);
- if (!secSrc.isEmpty())
+ Q_ASSERT(!url.isRelative());
+ secUrl = url;
+ if (!secUrl.isEmpty())
QFxPixmap::get(qmlEngine(this), secUrl,this,SLOT(secondaryLoaded()));
}
@@ -183,7 +183,7 @@ void QFxBlendedImage::setSmoothTransform(bool s)
void QFxBlendedImage::paintContents(QPainter &p)
{
- if (primSrc.isNull() && secSrc.isNull())
+ if (primUrl.isEmpty() && secUrl.isEmpty())
return;
if (_smooth) {
diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h
index baf4b64..7169b92 100644
--- a/src/declarative/fx/qfxblendedimage.h
+++ b/src/declarative/fx/qfxblendedimage.h
@@ -57,18 +57,18 @@ class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem
{
Q_OBJECT
- Q_PROPERTY(QString primaryUrl READ primaryUrl WRITE setPrimaryUrl)
- Q_PROPERTY(QString secondaryUrl READ secondaryUrl WRITE setSecondaryUrl)
+ Q_PROPERTY(QUrl primaryUrl READ primaryUrl WRITE setPrimaryUrl)
+ Q_PROPERTY(QUrl secondaryUrl READ secondaryUrl WRITE setSecondaryUrl)
Q_PROPERTY(qreal blend READ blend WRITE setBlend)
Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
public:
QFxBlendedImage(QFxItem *parent=0);
- QString primaryUrl() const;
- void setPrimaryUrl(const QString &);
+ QUrl primaryUrl() const;
+ void setPrimaryUrl(const QUrl &);
- QString secondaryUrl() const;
- void setSecondaryUrl(const QString &);
+ QUrl secondaryUrl() const;
+ void setSecondaryUrl(const QUrl &);
qreal blend() const;
void setBlend(qreal);
@@ -87,8 +87,6 @@ private Q_SLOTS:
void secondaryLoaded();
private:
- QString primSrc;
- QString secSrc;
QUrl primUrl;
QUrl secUrl;
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index 6bf3148..3d5f413 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -128,7 +128,7 @@ QFxHighlightFilter::~QFxHighlightFilter()
\property QFxHighlightFilter::source
\brief the URL of the image to be used as the highlight.
*/
-QString QFxHighlightFilter::source() const
+QUrl QFxHighlightFilter::source() const
{
return d->source;
}
@@ -144,14 +144,14 @@ void QFxHighlightFilter::imageLoaded()
update();
}
-void QFxHighlightFilter::setSource(const QString &f)
+void QFxHighlightFilter::setSource(const QUrl &f)
{
- if (d->source == f)
+ if (d->url == f)
return;
- if (!d->source.isEmpty())
+ if (!d->url.isEmpty())
QFxPixmap::cancelGet(d->url, this);
- d->source = f;
- d->url = qmlContext(this)->resolvedUrl(f);
+ Q_ASSERT(!f.isRelative());
+ d->url = f;
#if defined(QFX_RENDER_OPENGL2)
d->tex.clear();
#endif
diff --git a/src/declarative/fx/qfxhighlightfilter.h b/src/declarative/fx/qfxhighlightfilter.h
index 19e95ac..33f0963 100644
--- a/src/declarative/fx/qfxhighlightfilter.h
+++ b/src/declarative/fx/qfxhighlightfilter.h
@@ -56,7 +56,7 @@ class Q_DECLARATIVE_EXPORT QFxHighlightFilter : public QSimpleCanvasFilter
{
Q_OBJECT
- Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(bool tiled READ tiled WRITE setTiled NOTIFY tiledChanged)
Q_PROPERTY(int xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged)
Q_PROPERTY(int yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged)
@@ -64,8 +64,8 @@ public:
QFxHighlightFilter(QObject *parent=0);
virtual ~QFxHighlightFilter();
- QString source() const;
- void setSource(const QString &);
+ QUrl source() const;
+ void setSource(const QUrl &);
bool tiled() const;
void setTiled(bool);
@@ -76,7 +76,7 @@ public:
void setYOffset(int);
Q_SIGNALS:
- void sourceChanged(const QString &);
+ void sourceChanged(const QUrl &);
void offsetChanged(int x, int y);
void tiledChanged(bool);
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 224c25e..05738e3 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -825,19 +825,19 @@ qreal QFxImage::progress() const
The content specified can be of any image type loadable by QImage. Alternatively,
you can specify an sci format file, which specifies both an image and it's scale grid.
*/
-QString QFxImage::source() const
+QUrl QFxImage::source() const
{
Q_D(const QFxImage);
- return d->source;
+ return d->url;
}
-void QFxImage::setSource(const QString &url)
+void QFxImage::setSource(const QUrl &url)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::PixmapLoad> perf;
#endif
Q_D(QFxImage);
- if (url == d->source)
+ if (url == d->url)
return;
if (d->sciReply) {
@@ -850,8 +850,7 @@ void QFxImage::setSource(const QString &url)
if (!d->sciurl.isEmpty())
QFxPixmap::cancelGet(d->sciurl, this);
- d->source = url;
- d->url = qmlContext(this)->resolvedUrl(url);
+ d->url = url;
d->sciurl = QUrl();
if (d->progress != 0.0) {
d->progress = 0.0;
@@ -872,7 +871,7 @@ void QFxImage::setSource(const QString &url)
}
#endif
emit statusChanged(d->status);
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
emit progressChanged(1.0);
update();
} else {
@@ -936,7 +935,7 @@ void QFxImage::requestFinished()
}
#endif
emit statusChanged(d->status);
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
emit progressChanged(1.0);
update();
}
diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h
index 4d5f134..35b921a 100644
--- a/src/declarative/fx/qfximage.h
+++ b/src/declarative/fx/qfximage.h
@@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QFxImage : public QFxItem
Q_ENUMS(Status)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(QFxScaleGrid *scaleGrid READ scaleGrid)
@@ -88,8 +88,8 @@ public:
Status status() const;
qreal progress() const;
- QString source() const;
- virtual void setSource(const QString &url);
+ QUrl source() const;
+ virtual void setSource(const QUrl &url);
virtual void dump(int depth);
virtual QString propertyInfo() const;
@@ -102,7 +102,7 @@ public:
#endif
Q_SIGNALS:
- void sourceChanged(const QString &);
+ void sourceChanged(const QUrl &);
void statusChanged(Status);
void progressChanged(qreal progress);
diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h
index cd07a37..1785abb 100644
--- a/src/declarative/fx/qfximage_p.h
+++ b/src/declarative/fx/qfximage_p.h
@@ -106,7 +106,6 @@ public:
#endif
QFxImage::Status status;
- QString source;
QUrl url;
QUrl sciurl;
QNetworkReply *sciReply;
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 7129757..09ec748 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -792,12 +792,12 @@ QFxItem *QFxItem::qmlItem() const
}
/*!
- \qmlproperty string Item::qml
- This property holds the dynamic QML for the item.
+ \qmlproperty url Item::qml
+ This property holds the dynamic URL of the QML for the item.
This property is used for dynamically loading QML into the
item. Querying for the QML only has meaning if the QML has been
- dynamically set; otherwise an empty string is returned.
+ dynamically set; otherwise an empty URL is returned.
*/
/*! \fn void QFxItem::qmlChanged()
@@ -809,32 +809,31 @@ QFxItem *QFxItem::qmlItem() const
/*!
\property QFxItem::qml
- This property holds the dynamic QML for the item.
+ This property holds the dynamic URL of the QML for the item.
This property is used for dynamically loading QML into the
item. Querying for the QML only has meaning if the QML has been
- dynamically set; otherwise an empty string is returned.
+ dynamically set; otherwise an empty URL is returned.
*/
-QString QFxItem::qml() const
+QUrl QFxItem::qml() const
{
Q_D(const QFxItem);
return d->_qml;
}
-void QFxItem::setQml(const QString &qml)
+void QFxItem::setQml(const QUrl &qml)
{
Q_D(QFxItem);
if (d->_qml == qml)
return;
if (!d->_qml.isEmpty()) {
- QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
+ QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
if (iter != d->_qmlChildren.end())
(*iter)->setOpacity(0.);
}
d->_qml = qml;
- d->_qmlurl = qmlContext(this)->resolvedUri(qml);
d->qmlItem = 0;
if (d->_qml.isEmpty()) {
@@ -842,14 +841,14 @@ void QFxItem::setQml(const QString &qml)
return;
}
- QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
+ QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
if (iter != d->_qmlChildren.end()) {
(*iter)->setOpacity(1.);
d->qmlItem = (*iter);
emit qmlChanged();
} else {
d->_qmlcomp =
- new QmlComponent(qmlEngine(this), d->_qmlurl, this);
+ new QmlComponent(qmlEngine(this), d->_qml, this);
if (!d->_qmlcomp->isLoading())
qmlLoaded();
else
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 8ca1f9e..3c872e1 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -111,7 +111,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS
Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
- Q_PROPERTY(QString qml READ qml WRITE setQml NOTIFY qmlChanged)
+ Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged)
Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged)
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY leftChanged)
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY topChanged)
@@ -171,8 +171,8 @@ public:
void setState(const QString &);
QFxItem *qmlItem() const;
- QString qml() const;
- void setQml(const QString &);
+ QUrl qml() const;
+ void setQml(const QUrl &);
bool flipVertically() const;
void setFlipVertically(bool);
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index a54f523..b38d877 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -133,9 +133,8 @@ public:
QFxAnchors *_anchors;
QFxContents *_contents;
QFxItem *qmlItem;
- QUrl _qmlurl;
QmlComponent *_qmlcomp;
- QString _qml;
+ QUrl _qml;
QList<QUrl> _qmlnewloading;
QList<QmlComponent*> _qmlnewcomp;
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 41fb5bc..25e359d 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -395,7 +395,6 @@ public:
void createParticle(int time);
void updateOpacity(QFxParticle &p, int age);
- QString source;
QUrl url;
QPixmap image;
int count;
@@ -642,10 +641,10 @@ QFxParticles::~QFxParticles()
\property QFxParticles::source
\brief the URL of the particle image.
*/
-QString QFxParticles::source() const
+QUrl QFxParticles::source() const
{
Q_D(const QFxParticles);
- return d->source;
+ return d->url;
}
void QFxParticles::imageLoaded()
@@ -659,18 +658,17 @@ void QFxParticles::imageLoaded()
update();
}
-void QFxParticles::setSource(const QString &name)
+void QFxParticles::setSource(const QUrl &name)
{
Q_D(QFxParticles);
- if (name == d->source)
+ if (name == d->url)
return;
- if (!d->source.isEmpty())
+ if (!d->url.isEmpty())
QFxPixmap::cancelGet(d->url, this);
if (name.isEmpty()) {
- d->source = name;
- d->url = QUrl();
+ d->url = name;
d->image = QPixmap();
#if defined(QFX_RENDER_OPENGL)
d->texDirty = true;
@@ -678,8 +676,8 @@ void QFxParticles::setSource(const QString &name)
#endif
update();
} else {
- d->source = name;
- d->url = qmlContext(this)->resolvedUrl(name);
+ d->url = name;
+ Q_ASSERT(!name.isRelative());
QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded()));
}
}
diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h
index 6ef2582..b3a569b 100644
--- a/src/declarative/fx/qfxparticles.h
+++ b/src/declarative/fx/qfxparticles.h
@@ -153,7 +153,7 @@ class Q_DECLARATIVE_EXPORT QFxParticles : public QFxItem
{
Q_OBJECT
- Q_PROPERTY(QString source READ source WRITE setSource)
+ Q_PROPERTY(QUrl source READ source WRITE setSource)
Q_PROPERTY(int count READ count WRITE setCount)
Q_PROPERTY(int lifeSpan READ lifeSpan WRITE setLifeSpan)
Q_PROPERTY(int lifeSpanDeviation READ lifeSpanDeviation WRITE setLifeSpanDeviation)
@@ -172,8 +172,8 @@ public:
QFxParticles(QFxItem *parent=0);
~QFxParticles();
- QString source() const;
- void setSource(const QString &);
+ QUrl source() const;
+ void setSource(const QUrl &);
int count() const;
void setCount(int cnt);
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index bfccd34..d15502b 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -287,7 +287,7 @@ void QFxWebView::componentComplete()
Q_D(QFxWebView);
switch (d->pending) {
case QFxWebViewPrivate::PendingUrl:
- setUrl(d->pending_url.toString());
+ setUrl(d->pending_url);
break;
case QFxWebViewPrivate::PendingHtml:
setHtml(d->pending_string, d->pending_url);
@@ -339,7 +339,7 @@ void QFxWebView::doLoadFinished(bool ok)
}
/*!
- \qmlproperty string WebView::url
+ \qmlproperty url WebView::url
This property holds the URL to the page displayed in this item.
Note that after this property is set, it may take some time
@@ -358,24 +358,22 @@ void QFxWebView::doLoadFinished(bool ok)
Emitted when loading of the URL successfully starts after
setUrl() is called.
*/
-QString QFxWebView::url() const
+QUrl QFxWebView::url() const
{
- return page()->mainFrame()->url().toString();
+ return page()->mainFrame()->url();
}
-void QFxWebView::setUrl(const QString &n)
+void QFxWebView::setUrl(const QUrl &url)
{
Q_D(QFxWebView);
- if (n == page()->mainFrame()->url().toString())
+ if (url == page()->mainFrame()->url())
return;
page()->setViewportSize(QSize(
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
- QUrl url(n);
- if (url.isRelative())
- url = qmlContext(this)->resolvedUrl(n);
+ Q_ASSERT(!url.isRelative());
if (isComponentComplete())
page()->mainFrame()->load(url);
@@ -942,7 +940,7 @@ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl)
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
if (isComponentComplete())
- page()->mainFrame()->setHtml(html, qmlContext(this)->resolvedUrl(baseUrl));
+ page()->mainFrame()->setHtml(html, baseUrl);
else {
d->pending = d->PendingHtml;
d->pending_url = baseUrl;
diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h
index 28ef6c3..f30fd0d 100644
--- a/src/declarative/fx/qfxwebview.h
+++ b/src/declarative/fx/qfxwebview.h
@@ -90,7 +90,7 @@ class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem
Q_PROPERTY(int idealWidth READ idealWidth WRITE setIdealWidth NOTIFY idealWidthChanged)
Q_PROPERTY(int idealHeight READ idealHeight WRITE setIdealHeight NOTIFY idealHeightChanged)
- Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
+ Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
@@ -108,8 +108,8 @@ public:
QFxWebView(QFxItem *parent=0);
~QFxWebView();
- QString url() const;
- void setUrl(const QString &);
+ QUrl url() const;
+ void setUrl(const QUrl &);
QString title() const;