summaryrefslogtreecommitdiffstats
path: root/examples/graphicsview/dragdroprobot
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/graphicsview/dragdroprobot
parent5feefb0c039dae04290d1fca7c2f24276b6f7582 (diff)
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
Diffstat (limited to 'examples/graphicsview/dragdroprobot')
-rw-r--r--examples/graphicsview/dragdroprobot/dragdroprobot.pro3
-rw-r--r--examples/graphicsview/dragdroprobot/main.cpp24
2 files changed, 25 insertions, 2 deletions
diff --git a/examples/graphicsview/dragdroprobot/dragdroprobot.pro b/examples/graphicsview/dragdroprobot/dragdroprobot.pro
index 5240b4208f..0fe241dbd2 100644
--- a/examples/graphicsview/dragdroprobot/dragdroprobot.pro
+++ b/examples/graphicsview/dragdroprobot/dragdroprobot.pro
@@ -18,3 +18,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/dragdroprobot
INSTALLS += target sources
symbian: CONFIG += qt_example
+maemo5: CONFIG += qt_example
+
+simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/graphicsview/dragdroprobot/main.cpp b/examples/graphicsview/dragdroprobot/main.cpp
index 315d2b6917..c8b84ecb97 100644
--- a/examples/graphicsview/dragdroprobot/main.cpp
+++ b/examples/graphicsview/dragdroprobot/main.cpp
@@ -45,6 +45,22 @@
#include <math.h>
+class GraphicsView : public QGraphicsView
+{
+public:
+ GraphicsView(QGraphicsScene *scene) : QGraphicsView(scene)
+ {
+ }
+
+protected:
+ virtual void resizeEvent(QResizeEvent *event)
+ {
+#if defined(Q_OS_SYMBIAN)
+ fitInView(sceneRect(), Qt::KeepAspectRatio);
+#endif
+ }
+};
+
//! [0]
int main(int argc, char **argv)
{
@@ -69,12 +85,16 @@ int main(int argc, char **argv)
scene.addItem(robot);
//! [1]
//! [2]
- QGraphicsView view(&scene);
+ GraphicsView view(&scene);
view.setRenderHint(QPainter::Antialiasing);
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
view.setBackgroundBrush(QColor(230, 200, 167));
view.setWindowTitle("Drag and Drop Robot");
- view.show();
+#if defined(Q_OS_SYMBIAN)
+ view.showMaximized();
+#else
+ view.show();
+#endif
return app.exec();
}