Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
include
"qpixeltool.h"
5
6
#
include
<
qapplication
.
h
>
7
#
include
<
qcommandlineparser
.
h
>
8
#
include
<
qcommandlineoption
.
h
>
9
#
include
<
qfileinfo
.
h
>
10
11
QT_USE_NAMESPACE
12
13
using
namespace
Qt::StringLiterals;
14
15
int
main
(
int
argc,
char
**argv)
16
{
17
QApplication app(argc, argv);
18
QCoreApplication::setApplicationName(
"PixelTool"_L1
);
19
QCoreApplication::setApplicationVersion(QLatin1StringView(qVersion()));
20
QCoreApplication::setOrganizationName(
"QtProject"_L1
);
21
22
QCommandLineParser
parser;
23
parser.addHelpOption();
24
parser.addVersionOption();
25
parser.addPositionalArgument(
"preview"_L1
,
26
"The preview image to show."_L1
);
27
28
parser.process(app);
29
30
QPixelTool
pixelTool;
31
32
if
(!parser.positionalArguments().isEmpty()) {
33
const
QString previewImageFileName = parser.positionalArguments().constFirst();
34
if
(QFileInfo::exists(previewImageFileName)) {
35
QImage previewImage(previewImageFileName);
36
if
(!previewImage.size().isEmpty())
37
pixelTool.setPreviewImage(previewImage);
38
}
39
}
40
41
pixelTool.show();
42
43
QObject::connect(&app, &QApplication::lastWindowClosed,
44
&app, &QCoreApplication::quit);
45
46
return
QCoreApplication::exec();
47
}
QCommandLineParser
The QCommandLineParser class provides a means for handling the command line options.
Definition
qcommandlineparser.h:21
QPixelTool
Definition
qpixeltool.h:13
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
qttools
src
pixeltool
main.cpp
Generated on
for Qt by
1.18.0