diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2011-10-02 18:18:42 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-03 11:47:31 +0200 |
commit | aa6850d950e8523c47cacdaf54c918de53299d80 (patch) | |
tree | d40864bc3a4b3e8cf07010be32c5ee0625d95e93 /examples/qt3d/geometry | |
parent | 2b61e0a75b09f8dc05b298069da43d477db69910 (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/geometry')
-rw-r--r-- | examples/qt3d/geometry/geometryview.cpp | 4 | ||||
-rw-r--r-- | examples/qt3d/geometry/geometryview.h | 2 | ||||
-rw-r--r-- | examples/qt3d/geometry/main.cpp | 29 |
3 files changed, 27 insertions, 8 deletions
diff --git a/examples/qt3d/geometry/geometryview.cpp b/examples/qt3d/geometry/geometryview.cpp index 762e56fcd..4c690e4ef 100644 --- a/examples/qt3d/geometry/geometryview.cpp +++ b/examples/qt3d/geometry/geometryview.cpp @@ -55,7 +55,7 @@ #include "qglmaterialcollection.h" #include "qgraphicsscale3d.h" -GeometryView::GeometryView(QWidget *parent) +GeometryView::GeometryView(QWindow *parent) : QGLView(parent) , timer(new QTimer(this)) { @@ -118,5 +118,5 @@ void GeometryView::paintGL(QGLPainter *painter) void GeometryView::rotate() { angle = (angle + 2) % 360; - updateGL(); + update(); } diff --git a/examples/qt3d/geometry/geometryview.h b/examples/qt3d/geometry/geometryview.h index 822a7a409..631d48598 100644 --- a/examples/qt3d/geometry/geometryview.h +++ b/examples/qt3d/geometry/geometryview.h @@ -57,7 +57,7 @@ class GeometryView : public QGLView { Q_OBJECT public: - GeometryView(QWidget *parent = 0); + GeometryView(QWindow *parent = 0); ~GeometryView(); protected: diff --git a/examples/qt3d/geometry/main.cpp b/examples/qt3d/geometry/main.cpp index 725066bb4..6b8ea814d 100644 --- a/examples/qt3d/geometry/main.cpp +++ b/examples/qt3d/geometry/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(); } |