diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2020-05-06 11:56:27 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2020-05-14 15:31:58 +0200 |
commit | d4042c8cd82b35b3ec67c4309d80c9c92f55d889 (patch) | |
tree | 7c216eb3befd3839f822ee4fb6f4c0ca47581227 /tests/manual | |
parent | 7ad4b549442472e8c950189dd78b2e83098baa48 (diff) |
Add -viewonly option to qmlscenegrabber
Manual cherry pick of qtquick3d 1148116b8549982cc3113174b01987a00a730cf6
Change-Id: I8191256a238b733f62d75261896354a11b5430d7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegrabber/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp index 23c678380c..55dc86b9fd 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp +++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp @@ -58,8 +58,10 @@ class GrabbingView : public QQuickView public: GrabbingView(const QString &outputFile) - : ofile(outputFile), grabNo(0), isGrabbing(false), initDone(false) + : ofile(outputFile), grabNo(0), isGrabbing(false), initDone(false), justShow(outputFile.isEmpty()) { + if (justShow) + return; grabTimer = new QTimer(this); grabTimer->setSingleShot(true); grabTimer->setInterval(SCENE_STABLE_TIME); @@ -136,11 +138,12 @@ private slots: private: QImage lastGrab; - QTimer *grabTimer; + QTimer *grabTimer = nullptr; QString ofile; int grabNo; bool isGrabbing; bool initDone; + bool justShow; }; @@ -153,6 +156,7 @@ int main(int argc, char *argv[]) // Parse command line QString ifile, ofile; bool noText = false; + bool justShow = false; QStringList args = a.arguments(); int i = 0; bool argError = false; @@ -167,6 +171,9 @@ int main(int argc, char *argv[]) else if (arg == "--cache-distance-fields") { ; } + else if (arg == "-viewonly") { + justShow = true; + } else if (ifile.isEmpty()) { ifile = arg; } @@ -175,8 +182,8 @@ int main(int argc, char *argv[]) break; } } - if (argError || ifile.isEmpty() || ofile.isEmpty()) { - qWarning() << "Usage:" << args.at(0).toLatin1().constData() << "[-notext] <qml-infile> -o <outfile or - for ppm on stdout>"; + if (argError || ifile.isEmpty() || (ofile.isEmpty() && !justShow)) { + qWarning() << "Usage:" << args.at(0).toLatin1().constData() << "[-notext] <qml-infile> {-o <outfile or - for ppm on stdout>|-viewonly}"; return 1; } |