blob: 013f7d8689fd9b7f4742332cce06a388f8e77359 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
}
|