diff options
Diffstat (limited to 'examples/graphicsview/weatheranchorlayout/main.cpp')
-rw-r--r-- | examples/graphicsview/weatheranchorlayout/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp index 67596ac4bc..b1f2c724a1 100644 --- a/examples/graphicsview/weatheranchorlayout/main.cpp +++ b/examples/graphicsview/weatheranchorlayout/main.cpp @@ -51,6 +51,21 @@ #include <QGraphicsSceneResizeEvent> +class GraphicsView : public QGraphicsView +{ +public: + GraphicsView(QGraphicsScene *scene, QGraphicsWidget *widget) : QGraphicsView(scene), w(widget) + { + } + + virtual void resizeEvent(QResizeEvent *event) + { + w->setGeometry(0, 0, event->size().width(), event->size().height()); + } + + QGraphicsWidget *w; +}; + class PixmapWidget : public QGraphicsLayoutItem { @@ -175,7 +190,10 @@ int main(int argc, char **argv) QApplication app(argc, argv); QGraphicsScene scene; +#if defined(Q_OS_SYMBIAN) +#else scene.setSceneRect(0, 0, 800, 480); +#endif // pixmaps widgets PixmapWidget *title = new PixmapWidget(QPixmap(":/images/title.jpg")); @@ -250,8 +268,13 @@ int main(int argc, char **argv) // QGV setup scene.addItem(w); scene.setBackgroundBrush(Qt::white); +#if defined(Q_OS_SYMBIAN) + GraphicsView *view = new GraphicsView(&scene, w); + view->showMaximized(); +#else QGraphicsView *view = new QGraphicsView(&scene); view->show(); +#endif return app.exec(); } |