summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ham <christopher.ham@nokia.com>2010-12-03 06:20:58 (GMT)
committerChristopher Ham <christopher.ham@nokia.com>2010-12-03 06:34:25 (GMT)
commitb02cf26c0c236679439826cb8093f6dd6d3b2fec (patch)
treebe166040a0ba410a25b41da6586a98cd35b0890d
parenta305814f8f59f634943d8d5f8d87d2fd49891cb3 (diff)
downloadQt-b02cf26c0c236679439826cb8093f6dd6d3b2fec.zip
Qt-b02cf26c0c236679439826cb8093f6dd6d3b2fec.tar.gz
Qt-b02cf26c0c236679439826cb8093f6dd6d3b2fec.tar.bz2
borderImage should not support setting sourceSize
SIGNAL sourceSizeChanged is properly called. Setting the sourceSize for borderImage in QML returns a warning. Auto tests were added to check that sourceSize remains consistent. Reviewed-by: Joona Petrell
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage_p.h2
-rw-r--r--tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp4
3 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index c770a85..0bf09ad 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -246,6 +246,12 @@ void QDeclarativeBorderImage::setSource(const QUrl &url)
load();
}
+void QDeclarativeBorderImage::setSourceSize(const QSize& size)
+{
+ Q_UNUSED(size);
+ qmlInfo(this) << "Setting sourceSize for borderImage not supported";
+}
+
void QDeclarativeBorderImage::load()
{
Q_D(QDeclarativeBorderImage);
@@ -315,6 +321,7 @@ void QDeclarativeBorderImage::load()
d->progress = 1.0;
emit statusChanged(d->status);
emit progressChanged(d->progress);
+ requestFinished();
update();
}
}
@@ -475,6 +482,9 @@ void QDeclarativeBorderImage::requestFinished()
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
+ if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height())
+ emit sourceSizeChanged();
+
d->progress = 1.0;
emit statusChanged(d->status);
emit progressChanged(1.0);
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
index 9944cbe..7cf24f2 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
@@ -80,6 +80,8 @@ public:
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
void setSource(const QUrl &url);
+ void setSourceSize(const QSize&);
+
Q_SIGNALS:
void horizontalTileModeChanged();
void verticalTileModeChanged();
diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
index 2f00f60..5478145 100644
--- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
+++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
@@ -153,6 +153,8 @@ void tst_qdeclarativeborderimage::imageSource()
QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Ready);
QCOMPARE(obj->width(), 120.);
QCOMPARE(obj->height(), 120.);
+ QCOMPARE(obj->sourceSize().width(), 120);
+ QCOMPARE(obj->sourceSize().height(), 120);
QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch);
QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch);
} else {
@@ -192,6 +194,8 @@ void tst_qdeclarativeborderimage::resized()
QVERIFY(obj != 0);
QCOMPARE(obj->width(), 300.);
QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->sourceSize().width(), 120);
+ QCOMPARE(obj->sourceSize().height(), 120);
QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch);
QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch);