From b83610a567c031f10d565a64edd4cb8b4d55a53a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Feb 2010 16:52:53 +1000 Subject: Test SizeItemToLoader to SizeLoaderToItem resizeMode change. Task-number: QT-2376 --- src/declarative/graphicsitems/qmlgraphicsloader.cpp | 6 ++++++ tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp index 7cd4d1a..50267fc 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp @@ -346,6 +346,12 @@ qreal QmlGraphicsLoader::progress() const \o SizeItemToLoader - the item will be sized to the size of the Loader. \endlist + Note that changing from SizeItemToLoader to SizeLoaderToItem + after the component is loaded will not return the item or Loader + to it's original size. This is due to the item size being adjusted + to the Loader size, thereby losing the original size of the item. + Future changes to the item's size will affect the loader, however. + The default resizeMode is SizeLoaderToItem. */ QmlGraphicsLoader::ResizeMode QmlGraphicsLoader::resizeMode() const diff --git a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp index 9d61f50..ffd46a9 100644 --- a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp +++ b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp @@ -274,6 +274,13 @@ void tst_QmlGraphicsLoader::sizeItemToLoader() loader->setHeight(30); QCOMPARE(rect->width(), 180.0); QCOMPARE(rect->height(), 30.0); + + // Switch mode + loader->setResizeMode(QmlGraphicsLoader::SizeLoaderToItem); + rect->setWidth(160); + rect->setHeight(45); + QCOMPARE(rect->width(), 160.0); + QCOMPARE(rect->height(), 45.0); } void tst_QmlGraphicsLoader::noResize() -- cgit v0.12