diff options
Diffstat (limited to 'tests/manual/examples/widgets/widgets/imageviewer/main.cpp')
-rw-r--r-- | tests/manual/examples/widgets/widgets/imageviewer/main.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/widgets/imageviewer/main.cpp b/tests/manual/examples/widgets/widgets/imageviewer/main.cpp new file mode 100644 index 0000000000..013f7d8689 --- /dev/null +++ b/tests/manual/examples/widgets/widgets/imageviewer/main.cpp @@ -0,0 +1,24 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QApplication> +#include <QCommandLineParser> + +#include "imageviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QGuiApplication::setApplicationDisplayName(ImageViewer::tr("Image Viewer")); + QCommandLineParser commandLineParser; + commandLineParser.addHelpOption(); + commandLineParser.addPositionalArgument(ImageViewer::tr("[file]"), ImageViewer::tr("Image file to open.")); + commandLineParser.process(QCoreApplication::arguments()); + ImageViewer imageViewer; + if (!commandLineParser.positionalArguments().isEmpty() + && !imageViewer.loadFile(commandLineParser.positionalArguments().constFirst())) { + return -1; + } + imageViewer.show(); + return app.exec(); +} |