summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-21 23:16:08 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-21 23:16:08 (GMT)
commit511d86e88b33380116f27d5f6a2a0754e8f62fa0 (patch)
tree6fdcb11b5270984112bc2563738c24d2891595d4 /src/declarative/fx
parentaae3c899b10bee2dd64bb00bb2832620a47cff87 (diff)
parentfbf9db1fc6b500bfe05fdfca121986687d73d5c6 (diff)
downloadQt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.zip
Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.gz
Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/fx.pri2
-rw-r--r--src/declarative/fx/qfxanchors.cpp14
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp2
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.h2
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp11
-rw-r--r--src/declarative/fx/qfxblendedimage.h1
-rw-r--r--src/declarative/fx/qfxflowview.cpp380
-rw-r--r--src/declarative/fx/qfxflowview.h106
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp9
-rw-r--r--src/declarative/fx/qfximage.cpp17
-rw-r--r--src/declarative/fx/qfxitem.cpp6
-rw-r--r--src/declarative/fx/qfxparticles.cpp3
-rw-r--r--src/declarative/fx/qfxrect.cpp2
-rw-r--r--src/declarative/fx/qfxrect_p.h2
-rw-r--r--src/declarative/fx/qfxtextedit.cpp6
-rw-r--r--src/declarative/fx/qfxwebview.cpp2
16 files changed, 544 insertions, 21 deletions
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 90820fa..1c819e7 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -15,6 +15,7 @@ HEADERS += \
fx/qfxfocuspanel.h \
fx/qfxfocusrealm.h \
fx/qfxgridview.h \
+ fx/qfxflowview.h \
fx/qfxhighlightfilter.h \
fx/qfximage.h \
fx/qfxpainteditem.h \
@@ -63,6 +64,7 @@ SOURCES += \
fx/qfxfocuspanel.cpp \
fx/qfxfocusrealm.cpp \
fx/qfxgridview.cpp \
+ fx/qfxflowview.cpp \
fx/qfxhighlightfilter.cpp \
fx/qfximage.cpp \
fx/qfxpainteditem.cpp \
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index bd5520a..09d6178 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -325,6 +325,10 @@ QFxItem *QFxAnchors::fill() const
void QFxAnchors::setFill(QFxItem *f)
{
Q_D(QFxAnchors);
+ if (f != d->item->itemParent() && f->itemParent() != d->item->itemParent()){
+ qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return;
+ }
d->remDepend(d->fill);
d->fill = f;
d->addDepend(d->fill);
@@ -847,7 +851,10 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
return false;
- }else if (anchor.item == item){
+ } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
+ qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return false;
+ } else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
@@ -878,7 +885,10 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
return false;
- }else if (anchor.item == item){
+ } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
+ qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return false;
+ } else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index 604481c..d22959a 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -152,7 +152,7 @@ int QFxAnimatedImageItem::frameCount() const
return d->_movie->frameCount();
}
-void QFxAnimatedImageItem::setSource(const QString &url)
+void QFxAnimatedImageItem::setSource(const QUrl &url)
{
Q_D(QFxAnimatedImageItem);
if (url == d->url)
diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/fx/qfxanimatedimageitem.h
index a0d14c4..5d115d7 100644
--- a/src/declarative/fx/qfxanimatedimageitem.h
+++ b/src/declarative/fx/qfxanimatedimageitem.h
@@ -73,7 +73,7 @@ public:
int frameCount() const;
// Extends QFxImage's src property*/
- virtual void setSource(const QString&);
+ virtual void setSource(const QUrl&);
Q_SIGNALS:
void playingChanged();
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
index e216196..0c93fef 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/fx/qfxblendedimage.cpp
@@ -81,6 +81,17 @@ QFxBlendedImage::QFxBlendedImage(QFxItem *parent)
}
/*!
+ Cancels any pending image loads and destroys the image.
+*/
+QFxBlendedImage::~QFxBlendedImage()
+{
+ if (!primUrl.isEmpty())
+ QFxPixmap::cancelGet(primUrl,this);
+ if (!secUrl.isEmpty())
+ QFxPixmap::cancelGet(secUrl,this);
+}
+
+/*!
\qmlproperty string BlendedImage::primaryUrl
The URL of the first image to be displayed in this item.
*/
diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h
index 7169b92..248cc9d 100644
--- a/src/declarative/fx/qfxblendedimage.h
+++ b/src/declarative/fx/qfxblendedimage.h
@@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem
Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
public:
QFxBlendedImage(QFxItem *parent=0);
+ ~QFxBlendedImage();
QUrl primaryUrl() const;
void setPrimaryUrl(const QUrl &);
diff --git a/src/declarative/fx/qfxflowview.cpp b/src/declarative/fx/qfxflowview.cpp
new file mode 100644
index 0000000..e02e186
--- /dev/null
+++ b/src/declarative/fx/qfxflowview.cpp
@@ -0,0 +1,380 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfxvisualitemmodel.h"
+#include "qfxflowview.h"
+
+QT_BEGIN_NAMESPACE
+
+class QFxFlowViewAttached : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(int row READ row NOTIFY posChanged);
+Q_PROPERTY(int column READ column NOTIFY posChanged);
+public:
+ QFxFlowViewAttached(QObject *parent);
+
+ int row() const;
+ int column() const;
+
+signals:
+ void posChanged();
+
+private:
+ friend class QFxFlowView;
+ int m_row;
+ int m_column;
+};
+
+
+QFxFlowView::QFxFlowView()
+: m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1)
+{
+ setAcceptedMouseButtons(Qt::LeftButton);
+ setOptions(MouseEvents);
+}
+
+QFxVisualItemModel *QFxFlowView::model() const
+{
+ return m_model;
+}
+
+void QFxFlowView::setModel(QFxVisualItemModel *m)
+{
+ m_model = m;
+ refresh();
+}
+
+int QFxFlowView::columns() const
+{
+ return m_columns;
+}
+
+void QFxFlowView::setColumns(int c)
+{
+ m_columns = c;
+ refresh();
+}
+
+bool QFxFlowView::vertical() const
+{
+ return m_vertical;
+}
+
+void QFxFlowView::setVertical(bool v)
+{
+ m_vertical = v;
+}
+
+class QFxFlowViewValue : public QmlTimeLineValue
+{
+public:
+ enum Property { xProperty, yProperty };
+
+ QFxFlowViewValue(QFxItem *item, Property p)
+ : m_item(item), m_property(p) {}
+
+ qreal value() const {
+ return (m_property == xProperty)?m_item->x():m_item->y();
+ }
+ void setValue(qreal v) {
+ if (m_property == xProperty) m_item->setX(v);
+ else m_item->setY(v);
+ }
+private:
+ QFxItem *m_item;
+ Property m_property;
+};
+
+void QFxFlowView::refresh()
+{
+ if (m_model && m_columns >= 1) {
+ for (int ii = 0; ii < m_model->count(); ++ii) {
+ QFxItem *item = m_model->item(ii);
+ item->setParent(this);
+ item->setZ(0);
+ m_items << item;
+ }
+
+ reflow();
+ }
+}
+
+void QFxFlowView::reflow(bool animate)
+{
+ qreal y = 0;
+ qreal maxY = 0;
+ qreal x = 0;
+ int row = 0;
+ int column = -1;
+ if (animate)
+ clearTimeLine();
+
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ row = 0;
+ column++;
+ }
+
+ QFxItem *item = m_items.at(ii);
+ QFxFlowViewAttached *att =
+ (QFxFlowViewAttached *)qmlAttachedPropertiesObject<QFxFlowView>(item);
+ att->m_row = row;
+ att->m_column = column;
+ emit att->posChanged();
+
+
+ if (animate) {
+ if (vertical())
+ moveItem(item, QPointF(y, x));
+ else
+ moveItem(item, QPointF(x, y));
+ } else {
+ if (vertical()) {
+ item->setX(y);
+ item->setY(x);
+ } else {
+ item->setX(x);
+ item->setY(y);
+ }
+ }
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ ++row;
+ }
+}
+
+void QFxFlowView::reflowDrag(const QPointF &dp)
+{
+ qreal y = 0;
+ qreal maxY = 0;
+ qreal x = 0;
+
+ int flowedItems = 0;
+
+ clearTimeLine();
+
+ QList<QFxItem *> items;
+
+ bool dragUsed = false;
+ bool dragSeen = false;
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ }
+
+ QFxItem *item = m_items.at(ii);
+ if (item == m_dragItem)
+ dragSeen = true;
+ if (item == m_dragItem && dragUsed)
+ continue;
+ QRectF r;
+ if (vertical())
+ r = QRectF(y, x, item->width(), item->height());
+ else
+ r = QRectF(x, y, item->width(), item->height());
+ if (r.contains(dp)) {
+ dragUsed = true;
+ if (dragSeen)
+ m_dragIdx = items.count() + 1;
+ else
+ m_dragIdx = items.count();
+
+ items.append(m_dragItem);
+ if (m_dragItem != item) {
+ if (dragSeen)
+ items.insert(items.count() - 1, item);
+ else
+ items.append(item);
+ }
+ } else {
+ if (m_dragItem != item)
+ items.append(item);
+ }
+
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ }
+
+ y = 0;
+ maxY = 0;
+ x = 0;
+ clearTimeLine();
+ for (int ii = 0; ii < items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ }
+
+ QFxItem *item = items.at(ii);
+ if (item != m_dragItem) {
+ if (vertical())
+ moveItem(item, QPointF(y, x));
+ else
+ moveItem(item, QPointF(x, y));
+ }
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ }
+
+}
+
+void QFxFlowView::moveItem(QFxItem *item, const QPointF &p)
+{
+ QFxFlowViewValue *xv = new QFxFlowViewValue(item, QFxFlowViewValue::xProperty);
+ QFxFlowViewValue *yv = new QFxFlowViewValue(item, QFxFlowViewValue::yProperty);
+ m_values << xv << yv;
+ m_timeline.move(*xv, p.x(), 100);
+ m_timeline.move(*yv, p.y(), 100);
+}
+
+#include <QGraphicsSceneMouseEvent>
+
+void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ QFxItem *item = m_items.at(ii);
+ QRectF r = rectForItem(ii);
+
+ if (r.contains(event->pos())) {
+ m_dragItem = item;
+ m_dragItem->setZ(1);
+ m_dragOffset = r.topLeft() - event->pos();
+ event->accept();
+ return;
+ }
+ }
+ event->ignore();
+}
+
+QRectF QFxFlowView::rectForItem(int idx) const
+{
+ QFxItem *item = m_items.at(idx);
+ QRectF r(item->x(), item->y(), item->width(), item->height());
+ return r;
+}
+
+void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (m_dragItem) {
+ m_dragItem->setZ(0);
+
+ clearTimeLine();
+
+ if (m_dragIdx != -1) {
+ m_items.removeAll(m_dragItem);
+ m_items.insert(m_dragIdx, m_dragItem);
+ }
+
+ reflow(true);
+ m_dragItem = 0;
+ m_dragIdx = -1;
+ }
+}
+
+QFxFlowViewAttached::QFxFlowViewAttached(QObject *parent)
+: QObject(parent), m_row(0), m_column(0)
+{
+}
+
+int QFxFlowViewAttached::row() const
+{
+ return m_row;
+}
+
+int QFxFlowViewAttached::column() const
+{
+ return m_column;
+}
+
+QFxFlowViewAttached *QFxFlowView::qmlAttachedProperties(QObject *obj)
+{
+ return new QFxFlowViewAttached(obj);
+}
+
+void QFxFlowView::clearTimeLine()
+{
+ m_timeline.clear();
+ qDeleteAll(m_values);
+ m_values.clear();
+}
+
+void QFxFlowView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (m_dragItem) {
+ QPointF p = event->pos() + m_dragOffset;
+ m_dragItem->setX(p.x());
+ m_dragItem->setY(p.y());
+
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (m_items.at(ii) != m_dragItem && rectForItem(ii).contains(event->pos())) {
+ reflowDrag(event->pos());
+ }
+ }
+ }
+}
+
+QML_DEFINE_TYPE(QFxFlowView,FlowView);
+
+#include "qfxflowview.moc"
+
+QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxflowview.h b/src/declarative/fx/qfxflowview.h
new file mode 100644
index 0000000..0e7c2d3
--- /dev/null
+++ b/src/declarative/fx/qfxflowview.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFXFLOWVIEW_H
+#define QFXFLOWVIEW_H
+
+#include <QtDeclarative/QmlTimeLine>
+#include <QtDeclarative/qfxitem.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+class QFxVisualItemModel;
+class QFxFlowViewValue;
+class QFxFlowViewAttached;
+class Q_DECLARATIVE_EXPORT QFxFlowView : public QFxItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QFxVisualItemModel *model READ model WRITE setModel)
+ Q_PROPERTY(int column READ columns WRITE setColumns);
+ Q_PROPERTY(bool vertical READ vertical WRITE setVertical);
+
+public:
+ QFxFlowView();
+
+ QFxVisualItemModel *model() const;
+ void setModel(QFxVisualItemModel *);
+
+ int columns() const;
+ void setColumns(int);
+
+ bool vertical() const;
+ void setVertical(bool);
+
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+
+ static QFxFlowViewAttached *qmlAttachedProperties(QObject *);
+
+private:
+ QRectF rectForItem(int idx) const;
+ void refresh();
+ void reflow(bool animate = false);
+ void reflowDrag(const QPointF &);
+ void clearTimeLine();
+ int m_columns;
+ QFxVisualItemModel *m_model;
+ QList<QFxItem *> m_items;
+ bool m_vertical;
+ void moveItem(QFxItem *item, const QPointF &);
+
+ QPointF m_dragOffset;
+ QFxItem *m_dragItem;
+
+ QmlTimeLine m_timeline;
+ QList<QFxFlowViewValue *> m_values;
+ int m_dragIdx;
+};
+QML_DECLARE_TYPE(QFxFlowView);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFXFLOWVIEW_H
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index 3d5f413..1671fc6 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -58,7 +58,6 @@ public:
QFxHighlightFilterPrivate()
: xOffset(0), yOffset(0), tiled(false) {}
- QString source;
QUrl url;
int xOffset;
int yOffset;
@@ -115,6 +114,8 @@ QFxHighlightFilter::QFxHighlightFilter(QObject *parent)
QFxHighlightFilter::~QFxHighlightFilter()
{
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
delete d;
d = 0;
}
@@ -130,7 +131,7 @@ QFxHighlightFilter::~QFxHighlightFilter()
*/
QUrl QFxHighlightFilter::source() const
{
- return d->source;
+ return d->url;
}
void QFxHighlightFilter::imageLoaded()
@@ -140,7 +141,7 @@ void QFxHighlightFilter::imageLoaded()
if (!img.isNull())
d->tex.setImage(img.toImage());
#endif
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
update();
}
@@ -158,7 +159,7 @@ void QFxHighlightFilter::setSource(const QUrl &f)
if (!f.isEmpty())
QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded()));
else
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
}
/*!
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 05738e3..40389c4 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -127,6 +127,10 @@ QFxImage::~QFxImage()
Q_D(QFxImage);
if (d->sciReply)
d->sciReply->deleteLater();
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
+ if (!d->sciurl.isEmpty())
+ QFxPixmap::cancelGet(d->sciurl, this);
#if defined(QFX_RENDER_OPENGL)
if (d->tex) {
d->tex->release();
@@ -972,6 +976,13 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
d->status = Error;
emit statusChanged(d->status);
} else {
+ QFxScaleGrid *sg = scaleGrid();
+ sg->setTop(sci.gridTop());
+ sg->setBottom(sci.gridBottom());
+ sg->setLeft(sci.gridLeft());
+ sg->setRight(sci.gridRight());
+ setOptions(QFxImage::SimpleItem, false);
+
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
d->reply = QFxPixmap::get(qmlEngine(this), d->sciurl, this, SLOT(requestFinished()));
if (d->reply) {
@@ -981,12 +992,6 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
d->progress = 1.0;
emit progressChanged(d->progress);
}
- QFxScaleGrid *sg = scaleGrid();
- sg->setTop(sci.gridTop());
- sg->setBottom(sci.gridBottom());
- sg->setLeft(sci.gridLeft());
- sg->setRight(sci.gridRight());
- setOptions(QFxImage::SimpleItem, false);
}
}
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 648b0fb..079d691 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -901,11 +901,11 @@ void QFxItem::qmlLoaded()
QFxItem *qmlChild = qobject_cast<QFxItem *>(obj);
if (qmlChild) {
qmlChild->setItemParent(this);
- d->_qmlChildren.insert(d->_qml, qmlChild);
+ d->_qmlChildren.insert(d->_qml.toString(), qmlChild);
d->qmlItem = qmlChild;
} else {
delete qmlChild;
- d->_qml = QString();
+ d->_qml = QUrl();
}
delete d->_qmlcomp;
d->_qmlcomp = 0;
@@ -1962,7 +1962,7 @@ void QFxItem::newChild(const QString &type)
{
Q_D(QFxItem);
- QUrl url = qmlContext(this)->resolvedUri(type);
+ QUrl url = qmlContext(this)->resolvedUri(QUrl(type));
if (url.isEmpty())
return;
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 25e359d..4cd34c4 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -630,6 +630,9 @@ QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent)
QFxParticles::~QFxParticles()
{
+ Q_D(QFxParticles);
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
}
/*!
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index f55357f..fd8d9ca 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -391,6 +391,8 @@ void QFxRect::dump(int depth)
// steelblue rect using SVG color name
Rect { color: "steelblue" }
\endqml
+
+ The default color is white.
*/
/*!
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index f662fac..23bb944 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -72,7 +72,7 @@ public:
#if defined(QFX_RENDER_OPENGL)
rectTexture(0),
#endif //QFX_RENDER_OPENGL
- gradient(0), pen(0), radius(0)
+ color(Qt::white), gradient(0), pen(0), radius(0)
{
}
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 5492aaa..5f2f36c 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -682,7 +682,9 @@ void QFxTextEdit::keyPressEvent(QKeyEvent *event)
if (event->isAccepted())
return;
- QTextCursor c = textCursor();
+ //### this causes non-standard cursor behavior in some cases.
+ // is it still needed?
+ /*QTextCursor c = textCursor();
QTextCursor::MoveOperation op = QTextCursor::NoMove;
if (event == QKeySequence::MoveToNextChar) {
op = QTextCursor::Right;
@@ -700,7 +702,7 @@ void QFxTextEdit::keyPressEvent(QKeyEvent *event)
if (op != QTextCursor::NoMove && !c.movePosition(op))
event->ignore();
- else
+ else*/
d->control->processEvent(event, QPointF(0, 0));
}
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index d15502b..dc7f60e 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -1065,7 +1065,7 @@ QFxWebView *QFxWebPage::view()
QObject *QFxWebPage::createPlugin(const QString &, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
{
- QUrl comp = qmlContext(view())->resolvedUri(url.toString());
+ QUrl comp = qmlContext(view())->resolvedUri(url);
return new QWidget_Dummy_Plugin(comp,view(),paramNames,paramValues);
}