diff options
Diffstat (limited to 'examples/qt3d/builder/main.cpp')
-rw-r--r-- | examples/qt3d/builder/main.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/examples/qt3d/builder/main.cpp b/examples/qt3d/builder/main.cpp index 46c68467e..a773471e7 100644 --- a/examples/qt3d/builder/main.cpp +++ b/examples/qt3d/builder/main.cpp @@ -49,12 +49,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(); } |