summaryrefslogtreecommitdiffstats
path: root/examples/serialbus/modbus/client/main.cpp
blob: cbcf720123eb1b471a50426bca9fd2c210cc4b7b (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
25
26
27
28
29
30
31
32
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include "mainwindow.h"

#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QLoggingCategory>

using namespace Qt::StringLiterals;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QCommandLineParser parser;
    parser.setApplicationDescription(u"Modbus Client Example"_s);
    parser.addHelpOption();
    parser.addVersionOption();
    QCommandLineOption verboseOption(u"verbose"_s, u"Verbose mode"_s);
    parser.addOption(verboseOption);
    parser.process(a);

    if (parser.isSet(verboseOption))
        QLoggingCategory::setFilterRules(u"qt.modbus* = true"_s);

    MainWindow w;
    w.show();

    return a.exec();
}