diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-07-20 00:58:11 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-07-20 00:58:11 (GMT) |
commit | babb3bb4bb0de6cd2129d29fd6a90695bcbd53e2 (patch) | |
tree | c0a44c57e54e77dd31e2a68959e03256124cdfbd /src/declarative/extra | |
parent | 45cbfefe9d68152841beb6474c94eece0a085eb5 (diff) | |
parent | 1dc2e92b4630a0c19d1d2bdf5a05cd18003c566a (diff) | |
download | Qt-babb3bb4bb0de6cd2129d29fd6a90695bcbd53e2.zip Qt-babb3bb4bb0de6cd2129d29fd6a90695bcbd53e2.tar.gz Qt-babb3bb4bb0de6cd2129d29fd6a90695bcbd53e2.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/extra')
-rw-r--r-- | src/declarative/extra/extra.pri | 2 | ||||
-rw-r--r-- | src/declarative/extra/qfxanimatedimageitem.h | 2 | ||||
-rw-r--r-- | src/declarative/extra/qfxblendedimage.cpp | 308 | ||||
-rw-r--r-- | src/declarative/extra/qfxblendedimage.h | 111 | ||||
-rw-r--r-- | src/declarative/extra/qfxparticles.cpp | 150 | ||||
-rw-r--r-- | src/declarative/extra/qfxparticles.h | 11 | ||||
-rw-r--r-- | src/declarative/extra/qmlbehaviour.cpp | 26 | ||||
-rw-r--r-- | src/declarative/extra/qmlbehaviour.h | 8 | ||||
-rw-r--r-- | src/declarative/extra/qmlfolderlistmodel.cpp | 4 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.cpp | 3 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.h | 2 |
11 files changed, 40 insertions, 587 deletions
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index 4179817..d3ce7eb 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -5,7 +5,6 @@ SOURCES += \ extra/qfxintegermodel.cpp \ extra/qmlfolderlistmodel.cpp \ extra/qfxanimatedimageitem.cpp \ - extra/qfxblendedimage.cpp \ extra/qfxflowview.cpp \ extra/qfxparticles.cpp \ extra/qmlbehaviour.cpp \ @@ -19,7 +18,6 @@ HEADERS += \ extra/qmlfolderlistmodel.h \ extra/qfxanimatedimageitem.h \ extra/qfxanimatedimageitem_p.h \ - extra/qfxblendedimage.h \ extra/qfxflowview.h \ extra/qfxparticles.h \ extra/qmlbehaviour.h \ diff --git a/src/declarative/extra/qfxanimatedimageitem.h b/src/declarative/extra/qfxanimatedimageitem.h index 86ded86..720d187 100644 --- a/src/declarative/extra/qfxanimatedimageitem.h +++ b/src/declarative/extra/qfxanimatedimageitem.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QFxAnimatedImageItem) - Q_DECLARE_PRIVATE(QFxAnimatedImageItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxAnimatedImageItem) }; QT_END_NAMESPACE diff --git a/src/declarative/extra/qfxblendedimage.cpp b/src/declarative/extra/qfxblendedimage.cpp deleted file mode 100644 index 0c93fef..0000000 --- a/src/declarative/extra/qfxblendedimage.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/**************************************************************************** -** -** 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 "qfxblendedimage.h" -#include <QtDeclarative/qmlcontext.h> - -#if defined(QFX_RENDER_OPENGL2) -#include <glbasicshaders.h> -#endif - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass BlendedImage - \brief The BlendedImage elements blends two different images depending on a blend ratio. - - This element can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ - -/*! - \internal - \class QFxBlendedImage - \brief The QFxBlendedImage blends two different images depending on a blend ratio. - - This class can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ -QFxBlendedImage::QFxBlendedImage(QFxItem *parent) -: QFxItem(parent), _blend(0), _smooth(false), dirty(false) -{ -#if defined(QFX_RENDER_OPENGL2) - setOptions(HasContents); -#endif -} - -/*! - 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. -*/ -QUrl QFxBlendedImage::primaryUrl() const -{ - return primUrl; -} - -void QFxBlendedImage::primaryLoaded() -{ - primPix = QFxPixmap(primUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setPrimaryUrl(const QUrl &url) -{ - if (primUrl == url) - return; - if (!primUrl.isEmpty()) - QFxPixmap::cancelGet(primUrl,this); - Q_ASSERT(!url.isRelative()); - primUrl = url; - if (!primUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), primUrl,this,SLOT(primaryLoaded())); -} - -/*! - \qmlproperty string BlendedImage::secondaryUrl - The URL of the second image to be displayed in this item. -*/ -QUrl QFxBlendedImage::secondaryUrl() const -{ - return secUrl; -} - -void QFxBlendedImage::secondaryLoaded() -{ - secPix = QFxPixmap(secUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setSecondaryUrl(const QUrl &url) -{ - if (secUrl == url) - return; - if (!secUrl.isEmpty()) - QFxPixmap::cancelGet(secUrl,this); - Q_ASSERT(!url.isRelative()); - secUrl = url; - if (!secUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), secUrl,this,SLOT(secondaryLoaded())); -} - -/*! - \qmlproperty real BlendedImage::blend - The ratio used to blend the two images. - - If blend has a value of 0, only the first image will be displayed. - If blend has a value of 1, only the second image will be displayed. -*/ -qreal QFxBlendedImage::blend() const -{ - return _blend; -} - -void QFxBlendedImage::setBlend(qreal b) -{ - _blend = b; - update(); -} - -/*! - \qmlproperty bool BlendedImage::smooth - - Set this property if you want the image to be smoothly filtered when scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If - the BlendedImage is displayed at its natural size, this property has no visual or - performance effect. - - \note Generally scaling artifacts are only visible if the image is stationary on - the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. - */ -bool QFxBlendedImage::smoothTransform() const -{ - return _smooth; -} - -void QFxBlendedImage::setSmoothTransform(bool s) -{ - if (_smooth == s) - return; - _smooth = s; - update(); -} - -#if defined(QFX_RENDER_QPAINTER) - -void QFxBlendedImage::paintContents(QPainter &p) -{ - if (primUrl.isEmpty() && secUrl.isEmpty()) - return; - - if (_smooth) { - p.save(); - p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth); - } - - if (_blend < 0.75) - p.drawPixmap(0, 0, primPix); - else - p.drawPixmap(0, 0, secPix); - - if (_smooth) { - p.restore(); - } -} - -#elif defined(QFX_RENDER_OPENGL2) - -void QFxBlendedImage::paintGLContents(GLPainter &p) -{ - static DualTextureBlendShader *shader = 0; - if (!shader) - shader = new DualTextureBlendShader(); - - if (dirty) { - prim.clear(); - sec.clear(); - prim.setImage(primPix.toImage()); - sec.setImage(secPix.toImage()); - - dirty = false; - } - - if (prim.isNull() || sec.isNull()) { - - return; - } - - GLfloat vertices[8]; - GLfloat texVertices[8]; - - float widthV = width(); - float heightV = height(); - if (!widthV) - widthV = qMax(primPix.width(), secPix.width()); - if (!heightV) - heightV = qMax(primPix.height(), secPix.height()); - - vertices[0] = 0; vertices[1] = heightV; - vertices[2] = widthV; vertices[3] = heightV; - vertices[4] = 0; vertices[5] = 0; - vertices[6] = widthV; vertices[7] = 0; - - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = 1; texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = 1; - texVertices[6] = 1; texVertices[7] = 1; - - if (_blend == 0 || _blend == 1) { - QGLShaderProgram *tshader = p.useTextureShader(); - - GLTexture *tex = 0; - - if (_blend == 0) - tex = &prim; - else - tex = &sec; - - tshader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - tshader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, tex->texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - tshader->disableAttributeArray(SingleTextureShader::Vertices); - tshader->disableAttributeArray(SingleTextureShader::TextureCoords); - } else { - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, prim.texture()); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, sec.texture()); - - shader->enable(); - shader->setOpacity(1); - qreal b = _blend; - if (b > 1) b = 1; - else if (b < 0) b = 0; - shader->setBlend(b); - shader->setTransform(p.activeTransform); - - shader->setAttributeArray(DualTextureBlendShader::Vertices, vertices, 2); - shader->setAttributeArray(DualTextureBlendShader::TextureCoords, texVertices, 2); - shader->setAttributeArray(DualTextureBlendShader::BlendTextureCoords, texVertices, 2); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - shader->disableAttributeArray(DualTextureBlendShader::Vertices); - shader->disableAttributeArray(DualTextureBlendShader::TextureCoords); - shader->disableAttributeArray(DualTextureBlendShader::BlendTextureCoords); - - glBindTexture(GL_TEXTURE_2D, 0); - glActiveTexture(GL_TEXTURE0); - } -} -#endif - -QML_DEFINE_TYPE(QFxBlendedImage,BlendedImage) - -QT_END_NAMESPACE diff --git a/src/declarative/extra/qfxblendedimage.h b/src/declarative/extra/qfxblendedimage.h deleted file mode 100644 index 44de94c..0000000 --- a/src/declarative/extra/qfxblendedimage.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** 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 QFXBLENDEDIMAGE_H -#define QFXBLENDEDIMAGE_H - -#include <QtDeclarative/qfxitem.h> -#if defined(QFX_RENDER_OPENGL2) -#include <gltexture.h> -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem -{ - Q_OBJECT - - 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); - ~QFxBlendedImage(); - - QUrl primaryUrl() const; - void setPrimaryUrl(const QUrl &); - - QUrl secondaryUrl() const; - void setSecondaryUrl(const QUrl &); - - qreal blend() const; - void setBlend(qreal); - - bool smoothTransform() const; - void setSmoothTransform(bool); - -#if defined(QFX_RENDER_QPAINTER) - void paintContents(QPainter &painter); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif - -private Q_SLOTS: - void primaryLoaded(); - void secondaryLoaded(); - -private: - QUrl primUrl; - QUrl secUrl; - - qreal _blend; - bool _smooth; - bool dirty; -#if defined(QFX_RENDER_OPENGL2) - GLTexture prim; - GLTexture sec; -#endif - QPixmap primPix; - QPixmap secPix; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QFxBlendedImage) - -QT_END_HEADER - -#endif // QFXBLENDEDIMAGE_H diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 3130f06..08d38ba 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -40,9 +40,6 @@ ****************************************************************************/ #include "private/qfxitem_p.h" -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif #include <stdlib.h> #include <math.h> @@ -58,7 +55,7 @@ #include <private/qmlanimation_p.h> #include "qfxparticles.h" - +#include <QPainter> QT_BEGIN_NAMESPACE #define PI_SQR 9.8696044 @@ -350,11 +347,7 @@ public: maxX = minX = maxY = minY = 0; } -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &p); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif void updateSize(); @@ -375,9 +368,6 @@ public: , angle(0), angleDev(0), velocity(0), velocityDev(0) , addParticleTime(0), addParticleCount(0), lastAdvTime(0), stream(false), streamDelay(0) , emitting(true), motion(0), clock(this) -#if defined(QFX_RENDER_OPENGL) - , texDirty(true) -#endif { } @@ -418,13 +408,8 @@ public: QList<QFxParticle> particles; QTickAnimationProxy<QFxParticlesPrivate, &QFxParticlesPrivate::tick> clock; -#if defined(QFX_RENDER_OPENGL) - bool texDirty; - GLTexture tex; -#endif }; -//TODO: Stop the clock if no visible particles and not emitting (restart on emittingChanged) void QFxParticlesPrivate::tick(int time) { Q_Q(QFxParticles); @@ -473,17 +458,15 @@ void QFxParticlesPrivate::tick(int time) } } } - while(particles.count() < count && particles.count() < percCount && streamWidth--) - createParticle(time); + while(particles.count() < count && + (!stream || (particles.count() < percCount && streamWidth--))) + createParticle(time); } lastAdvTime = time; - if (oldCount || particles.count()) { - if (q->itemParent()) - q->itemParent()->update(); - else - q->update(); - } else if (!count) { + paintItem->updateSize(); + paintItem->update(); + if (!(oldCount || particles.count()) && (!count || !emitting)) { lastAdvTime = 0; clock.stop(); } @@ -654,11 +637,8 @@ void QFxParticles::imageLoaded() { Q_D(QFxParticles); d->image = QFxPixmap(d->url); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - d->tex.clear(); -#endif - update(); + d->paintItem->updateSize(); + d->paintItem->update(); } void QFxParticles::setSource(const QUrl &name) @@ -673,11 +653,8 @@ void QFxParticles::setSource(const QUrl &name) if (name.isEmpty()) { d->url = name; d->image = QPixmap(); -#if defined(QFX_RENDER_OPENGL) - d->texDirty = true; - d->tex.clear(); -#endif - update(); + d->paintItem->updateSize(); + d->paintItem->update(); } else { d->url = name; Q_ASSERT(!name.isRelative()); @@ -704,12 +681,15 @@ void QFxParticles::setCount(int cnt) { Q_D(QFxParticles); if (cnt != d->count) { - if (!d->count && d->clock.state() != QAbstractAnimation::Running) - d->clock.start(); // infinity?? + int oldCount = d->count; d->count = cnt; d->addParticleTime = 0; d->addParticleCount = d->particles.count(); - update(); + if (!oldCount && d->clock.state() != QAbstractAnimation::Running) { + d->clock.start(); + } + d->paintItem->updateSize(); + d->paintItem->update(); } } @@ -1025,6 +1005,8 @@ void QFxParticles::setEmitting(bool r) { Q_D(QFxParticles); d->emitting = r; + if (d->count && r) + d->clock.start(); } /*! \qmlproperty ParticleMotion Particles::motion @@ -1059,31 +1041,16 @@ void QFxParticles::setMotion(QFxParticleMotion *motion) d->motion = motion; } -void QFxParticles::dump(int depth) -{ - Q_D(QFxParticles); - QByteArray ba(depth * 4, ' '); - qWarning() << ba.constData() << "URL:" << d->url << "Count:" << d->count; - QFxItem::dump(depth); -} - QString QFxParticles::propertyInfo() const { Q_D(const QFxParticles); return d->url.toString(); } -void QFxParticlesPainter::updateSize(){ - setX(-500); - setY(-500); - setWidth(1000); - setHeight(1000); - return ; - const int parentX = parent()->x(); - const int parentY = parent()->y(); - //Have to use statistical approach to needed size as arbitrary particle - //motions make it impossible to calculate. - //max/min vars stored to give a never shrinking rect +void QFxParticlesPainter::updateSize() +{ + const int parentX = parentItem()->x(); + const int parentY = parentItem()->y(); for (int i = 0; i < d->particles.count(); ++i) { const QFxParticle &particle = d->particles.at(i); if(particle.x > maxX) @@ -1106,7 +1073,6 @@ void QFxParticlesPainter::updateSize(){ setY(myY); } -#if defined(QFX_RENDER_QPAINTER) void QFxParticles::paintContents(QPainter &p) { Q_UNUSED(p); @@ -1118,82 +1084,24 @@ void QFxParticlesPainter::paintContents(QPainter &p) if (d->image.isNull()) return; - updateSize(); - const int myX = x() + parent()->x(); - const int myY = y() + parent()->y(); + const int myX = x() + parentItem()->x(); + const int myY = y() + parentItem()->y(); for (int i = 0; i < d->particles.count(); ++i) { const QFxParticle &particle = d->particles.at(i); p.setOpacity(particle.opacity); p.drawPixmap(particle.x - myX, particle.y - myY, d->image); } - update();//Should I need this? (GV does) -} -#elif defined(QFX_RENDER_OPENGL2) -void QFxParticles::paintGLContents(GLPainter &) -{ - //painting is done by the ParticlesPainter, so it can have the right size -} - -void QFxParticlesPainter::paintGLContents(GLPainter &p) -{ - - if (d->image.isNull()) - return; - - updateSize(); - - if (d->texDirty && !d->image.isNull()) { - d->tex.setImage(d->image.toImage()); - d->tex.setHorizontalWrap(GLTexture::Repeat); - d->tex.setVerticalWrap(GLTexture::Repeat); - } - d->texDirty = false; - - SingleTextureOpacityShader *shader = basicShaders()->singleTextureOpacity(); - shader->enable(); - shader->setTransform(p.activeTransform); - - glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - - const int myX = (int)(x() + parent()->x()); - const int myY = (int)(y() + parent()->y()); - float widthV = d->image.width(); - float heightV = d->image.height(); - for (int i = 0; i < d->particles.count(); ++i) { - const QFxParticle &particle = d->particles.at(i); - float left = particle.x - myX; - float right = particle.x - myX + widthV; - float top = particle.y - myY; - float bottom = particle.y - myY + heightV; - - GLfloat vertices[] = { left, bottom, - right, bottom, - left, top, - right, top }; - - GLfloat texVertices[] = { 0, 0, - 1, 0, - 0, 1, - 1, 1 }; - - shader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - shader->setOpacity(particle.opacity * p.activeOpacity); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - } - - shader->disableAttributeArray(SingleTextureShader::Vertices); - shader->disableAttributeArray(SingleTextureShader::TextureCoords); } -#endif void QFxParticles::componentComplete() { Q_D(QFxParticles); QFxItem::componentComplete(); - if (d->count) - d->clock.start(); // infinity?? + if (d->count) { + d->paintItem->updateSize(); + d->clock.start(); + } if (d->lifeSpanDev > d->lifeSpan) d->lifeSpanDev = d->lifeSpan; } diff --git a/src/declarative/extra/qfxparticles.h b/src/declarative/extra/qfxparticles.h index cfaffa7..9f085cd 100644 --- a/src/declarative/extra/qfxparticles.h +++ b/src/declarative/extra/qfxparticles.h @@ -44,10 +44,6 @@ #include <QtDeclarative/qfxitem.h> -#if defined(QFX_RENDER_OPENGL) -#include "gltexture.h" -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -207,14 +203,9 @@ public: QFxParticleMotion *motion() const; void setMotion(QFxParticleMotion *); - virtual void dump(int depth); virtual QString propertyInfo() const; -#if defined(QFX_RENDER_QPAINTER) void paintContents(QPainter &p); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif protected: virtual void componentComplete(); @@ -225,7 +216,7 @@ private Q_SLOTS: private: Q_DISABLE_COPY(QFxParticles) - Q_DECLARE_PRIVATE(QFxParticles) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxParticles) }; QT_END_NAMESPACE diff --git a/src/declarative/extra/qmlbehaviour.cpp b/src/declarative/extra/qmlbehaviour.cpp index f2d5e9a..92a85b0 100644 --- a/src/declarative/extra/qmlbehaviour.cpp +++ b/src/declarative/extra/qmlbehaviour.cpp @@ -75,15 +75,12 @@ private: class QmlBehaviourPrivate : public QObjectPrivate { public: - QmlBehaviourPrivate() - : context(0), valueData(0), operations(this) {} + QmlBehaviourPrivate() : operations(this) {} QmlMetaProperty property; QVariant currentValue; QVariant fromValue; QVariant toValue; - QmlContext *context; - QmlBehaviourData *valueData; class AnimationList : public QmlConcreteList<QmlAbstractAnimation *> { public: @@ -128,7 +125,6 @@ QmlBehaviour::QmlBehaviour(QObject *parent) : QmlPropertyValueSource(*(new QmlBehaviourPrivate), parent) { Q_D(QmlBehaviour); - d->valueData = new QmlBehaviourData(this); d->group = new QParallelAnimationGroup(this); } @@ -200,10 +196,6 @@ void QmlBehaviour::propertyValueChanged() //### does this clean up everything needed? d->group->stop(); - d->valueData->e = newValue; - d->valueData->s = d->currentValue; - emit d->valueData->valuesChanged(); - QmlStateOperation::ActionList actions; Action action; action.property = d->property; @@ -238,22 +230,6 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property) } } -void QmlBehaviour::classBegin() -{ - Q_D(QmlBehaviour); - if (!d->context) { - d->context = new QmlContext(qmlContext(this), this); - d->context->addDefaultObject(d->valueData); - } - d->context->activate(); -} - -void QmlBehaviour::classComplete() -{ - Q_D(QmlBehaviour); - d->context->deactivate(); -} - QT_END_NAMESPACE #include "qmlbehaviour.moc" diff --git a/src/declarative/extra/qmlbehaviour.h b/src/declarative/extra/qmlbehaviour.h index 1b5f524..99fc779 100644 --- a/src/declarative/extra/qmlbehaviour.h +++ b/src/declarative/extra/qmlbehaviour.h @@ -54,12 +54,10 @@ QT_MODULE(Declarative) class QmlAbstractAnimation; class QmlBehaviourPrivate; -class Q_DECLARATIVE_EXPORT QmlBehaviour : public QmlPropertyValueSource, - public QmlParserStatus +class Q_DECLARATIVE_EXPORT QmlBehaviour : public QmlPropertyValueSource { Q_OBJECT Q_DECLARE_PRIVATE(QmlBehaviour) - Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QVariant from READ fromValue WRITE setFromValue) Q_PROPERTY(QVariant to READ toValue WRITE setToValue) @@ -80,10 +78,6 @@ public: static bool _ignore; -protected: - virtual void classBegin(); - virtual void classComplete(); - private Q_SLOTS: void propertyValueChanged(); }; diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp index acee5e1..4a71109 100644 --- a/src/declarative/extra/qmlfolderlistmodel.cpp +++ b/src/declarative/extra/qmlfolderlistmodel.cpp @@ -161,7 +161,9 @@ void QmlFolderListModel::classComplete() bool QmlFolderListModel::isFolder(int index) const { Q_D(const QmlFolderListModel); - return d->model.isDir(d->model.index(index, 0, d->folderIndex)); + if (index != -1) + return d->model.isDir(d->model.index(index, 0, d->folderIndex)); + return false; } void QmlFolderListModel::refresh() diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 95c3de6..7f0029d 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -410,7 +410,7 @@ QmlXmlListModel::~QmlXmlListModel() } /*! - \qmlproperty list<XmlRole> QmlListModel::roles + \qmlproperty list<XmlRole> XmlListModel::roles The roles to make available for this model. */ @@ -645,6 +645,7 @@ void QmlXmlListModel::queryCompleted(int id, int size) if (size > 0) { d->data = d->qmlXmlQuery.modelData(); emit itemsInserted(0, d->size); + emit countChanged(); } } diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index d9871ab..3b6ffb4 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -98,6 +98,7 @@ class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public Q_PROPERTY(QString query READ query WRITE setQuery) Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations) Q_PROPERTY(QmlList<XmlListModelRole *> *roles READ roleObjects) + Q_PROPERTY(int count READ count NOTIFY countChanged) Q_CLASSINFO("DefaultProperty", "roles") public: @@ -130,6 +131,7 @@ public: signals: void statusChanged(Status); void progressChanged(qreal progress); + void countChanged(); public Q_SLOTS: void reload(); |