From 33b664eabe5d9621d71e5bf3bfcc46ea385a399c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 8 Jul 2010 15:30:58 +1000 Subject: Remove Image::pixmap property. QML applications should use QDeclarativeImageProvider to provide pixmaps instead. Task-number: QTBUG-11980 --- src/declarative/QmlChanges.txt | 7 +++-- .../graphicsitems/qdeclarativeimage.cpp | 10 ------- .../graphicsitems/qdeclarativeimage_p.h | 2 -- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 31 ---------------------- 4 files changed, 5 insertions(+), 45 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 125b939..259d9a9 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -16,8 +16,11 @@ Component: - errorsString() renamed to errorString() ListView: - ListView.prevSection property changed to ListView.previousSection - -TextInput xToPosition -> positionAt (to match TextEdit.positionAt) +TextInput: + - xToPosition -> positionAt (to match TextEdit.positionAt) +Image: + - pixmap property removed, use QDeclarativeImageProvider to serve pixmaps + instead QList models no longer provide properties in model object. The properties are now updated when the object changes. An object's property diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 666ff3f..34d33f5 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -116,15 +116,6 @@ QDeclarativeImage::~QDeclarativeImage() { } -/*! - \qmlproperty QPixmap Image::pixmap - - This property holds the QPixmap image to display. - - This is useful for displaying images provided by a C++ implementation, - for example, a model may provide a data role of type QPixmap. -*/ - QPixmap QDeclarativeImage::pixmap() const { Q_D(const QDeclarativeImage); @@ -524,7 +515,6 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi void QDeclarativeImage::pixmapChange() { updatePaintedGeometry(); - emit pixmapChanged(); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index a4f4475..c8bb30b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -57,7 +57,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeImage : public QDeclarativeImageBase Q_OBJECT Q_ENUMS(FillMode) - Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap NOTIFY pixmapChanged DESIGNABLE false) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedGeometryChanged) Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedGeometryChanged) @@ -79,7 +78,6 @@ public: void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); Q_SIGNALS: - void pixmapChanged(); void fillModeChanged(); void paintedGeometryChanged(); diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index df029f5..38fd458 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -88,7 +88,6 @@ private slots: void resized(); void preserveAspectRatio(); void smooth(); - void pixmap(); void svg(); void big(); void tiling_QTBUG_6716(); @@ -261,36 +260,6 @@ void tst_qdeclarativeimage::smooth() delete obj; } -void tst_qdeclarativeimage::pixmap() -{ - QString componentStr = "import Qt 4.7\nImage { pixmap: testPixmap }"; - - QPixmap pixmap; - QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("testPixmap", pixmap); - - QDeclarativeComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - - QDeclarativeImage *obj = qobject_cast(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->source(), QUrl()); - QVERIFY(obj->status() == QDeclarativeImage::Null); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); - QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); - QCOMPARE(obj->progress(), 0.0); - QVERIFY(obj->pixmap().isNull()); - - pixmap = QPixmap(SRCDIR "/data/colors.png"); - ctxt->setContextProperty("testPixmap", pixmap); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - QVERIFY(obj->status() == QDeclarativeImage::Ready); - - delete obj; -} - void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); -- cgit v0.12