summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/cube
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2011-10-02 18:18:42 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-03 11:47:31 +0200
commitaa6850d950e8523c47cacdaf54c918de53299d80 (patch)
treed40864bc3a4b3e8cf07010be32c5ee0625d95e93 /examples/qt3d/cube
parent2b61e0a75b09f8dc05b298069da43d477db69910 (diff)
Fixes for surface vs QOpenGLContext & QWindow.
With the qt5 refactor branch going in the ability to get a QPaintDevice has gone away - this was really a "relic from the desktop days". Painting still applies for FBO's and so on, but in the case of QML we are on an SG view and there is no paint device there. So move the QGLView to using a QWindow and QOpenGLContext as well to follow suit and replace all the logic in surface stuff to cope with that. Also update all examples, demos, tutorials and tests. Change-Id: Ie8dbeb97c87ef0821326fb7ccf5d5d4b1f90fd06 Reviewed-on: http://codereview.qt-project.org/5900 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'examples/qt3d/cube')
-rw-r--r--examples/qt3d/cube/cubeview.cpp2
-rw-r--r--examples/qt3d/cube/cubeview.h2
-rw-r--r--examples/qt3d/cube/main.cpp29
3 files changed, 26 insertions, 7 deletions
diff --git a/examples/qt3d/cube/cubeview.cpp b/examples/qt3d/cube/cubeview.cpp
index e8de75168..09a07eafe 100644
--- a/examples/qt3d/cube/cubeview.cpp
+++ b/examples/qt3d/cube/cubeview.cpp
@@ -44,7 +44,7 @@
#include <QtCore/qurl.h>
-CubeView::CubeView(QWidget *parent)
+CubeView::CubeView(QWindow *parent)
: QGLView(parent)
{
QGLBuilder builder;
diff --git a/examples/qt3d/cube/cubeview.h b/examples/qt3d/cube/cubeview.h
index 8996fd342..c184ff046 100644
--- a/examples/qt3d/cube/cubeview.h
+++ b/examples/qt3d/cube/cubeview.h
@@ -49,7 +49,7 @@ class CubeView : public QGLView
{
Q_OBJECT
public:
- CubeView(QWidget *parent = 0);
+ CubeView(QWindow *parent = 0);
~CubeView();
protected:
diff --git a/examples/qt3d/cube/main.cpp b/examples/qt3d/cube/main.cpp
index bad1c4c4f..dd9bc45da 100644
--- a/examples/qt3d/cube/main.cpp
+++ b/examples/qt3d/cube/main.cpp
@@ -48,12 +48,31 @@ int main(int argc, char *argv[])
if (view.stereoType() != QGLView::RedCyanAnaglyph)
view.camera()->setEyeSeparation(0.3f);
- if (QApplication::arguments().contains(QLatin1String("-maximize")))
- view.showMaximized();
- else if (QApplication::arguments().contains(QLatin1String("-fullscreen")))
- view.showFullScreen();
+ QStringList args = QCoreApplication::arguments();
+ int w_pos = args.indexOf("-width");
+ int h_pos = args.indexOf("-height");
+ if (w_pos >= 0 && h_pos >= 0)
+ {
+ bool ok = true;
+ int w = args.at(w_pos + 1).toInt(&ok);
+ if (!ok)
+ {
+ qWarning() << "Could not parse width argument:" << args;
+ return 1;
+ }
+ int h = args.at(h_pos + 1).toInt(&ok);
+ if (!ok)
+ {
+ qWarning() << "Could not parse height argument:" << args;
+ return 1;
+ }
+ view.resize(w, h);
+ }
else
- view.show();
+ {
+ view.resize(800, 600);
+ }
+ view.show();
return app.exec();
}