summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2008-06-23 13:16:36 +0200
committerSamuel Rødal <sroedal@trolltech.com>2008-06-23 13:16:36 +0200
commitbf6b869c9f0fc2d4e1279234eb5be248d9c9d129 (patch)
tree8bcb3b4192313cb52553e20a12c1391f23512edd /main.cpp
parent4ee8805b00b0b8f630563d995883c8f04280c841 (diff)
Rename: GraphicsScene -> OpenGLScene
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 18cff27..d2702c7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,17 +1,30 @@
-#include "graphicsscene.h"
+#include "openglscene.h"
#include <QtOpenGL>
+class GraphicsView : public QGraphicsView
+{
+protected:
+ void resizeEvent(QResizeEvent *event) {
+ if (scene())
+ scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
+ QGraphicsView::resizeEvent(event);
+ }
+};
+
int main(int argc, char **argv)
{
QApplication app(argc, argv);
- QGraphicsView view(new GraphicsScene);
+ GraphicsView view;
view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ view.setScene(new OpenGLScene);
view.show();
+ view.resize(1024, 768);
+
return app.exec();
}