From 0748751c9f097d9d866605306bbdd4b96e2a5c4e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 27 Apr 2011 19:16:41 +0200 Subject: Squashed commit of the changes from the mobile-examples repository (4.7-generated-declarative branch). --- examples/painting/imagecomposition/imagecomposer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'examples/painting/imagecomposition/imagecomposer.cpp') 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); -- cgit v1.2.3