summaryrefslogtreecommitdiffstats
path: root/examples/painting/imagecomposition/imagecomposer.cpp
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-04-27 19:16:41 +0200
committerDavid Boddie <david.boddie@nokia.com>2011-05-23 14:24:07 +0200
commit0748751c9f097d9d866605306bbdd4b96e2a5c4e (patch)
tree1838365e6ad6592a26e193289d2136cb89319972 /examples/painting/imagecomposition/imagecomposer.cpp
parent5feefb0c039dae04290d1fca7c2f24276b6f7582 (diff)
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
Diffstat (limited to 'examples/painting/imagecomposition/imagecomposer.cpp')
-rw-r--r--examples/painting/imagecomposition/imagecomposer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/painting/imagecomposition/imagecomposer.cpp b/examples/painting/imagecomposition/imagecomposer.cpp
index a41f405fd0..9488204e30 100644
--- a/examples/painting/imagecomposition/imagecomposer.cpp
+++ b/examples/painting/imagecomposition/imagecomposer.cpp
@@ -43,7 +43,11 @@
#include "imagecomposer.h"
//! [0]
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
+static const QSize resultSize(50, 50);
+#else
static const QSize resultSize(200, 200);
+#endif
//! [0]
//! [1]
@@ -104,7 +108,10 @@ ImageComposer::ImageComposer()
mainLayout->addWidget(destinationButton, 0, 2, 3, 1);
mainLayout->addWidget(equalLabel, 1, 3);
mainLayout->addWidget(resultLabel, 0, 4, 3, 1);
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+#else
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
+#endif
setLayout(mainLayout);
//! [4]
@@ -176,6 +183,9 @@ void ImageComposer::loadImage(const QString &fileName, QImage *image,
{
image->load(fileName);
+ // Scale the image to given size
+ *image = image->scaled(resultSize, Qt::KeepAspectRatio);
+
QImage fixedImage(resultSize, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&fixedImage);
painter.setCompositionMode(QPainter::CompositionMode_Source);