mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-12-02 08:33:00 +08:00
30 lines
911 B
C++
30 lines
911 B
C++
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||
|
|
||
|
#include <QApplication>
|
||
|
#include <QCommandLineParser>
|
||
|
#include <QCommandLineOption>
|
||
|
|
||
|
#include "mainwindow.h"
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
QApplication app(argc, argv);
|
||
|
QCoreApplication::setApplicationName("MDI Example");
|
||
|
QCoreApplication::setOrganizationName("QtProject");
|
||
|
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
|
||
|
QCommandLineParser parser;
|
||
|
parser.setApplicationDescription("Qt MDI Example");
|
||
|
parser.addHelpOption();
|
||
|
parser.addVersionOption();
|
||
|
parser.addPositionalArgument("file", "The file to open.");
|
||
|
parser.process(app);
|
||
|
|
||
|
MainWindow mainWin;
|
||
|
const QStringList posArgs = parser.positionalArguments();
|
||
|
for (const QString &fileName : posArgs)
|
||
|
mainWin.openFile(fileName);
|
||
|
mainWin.show();
|
||
|
return app.exec();
|
||
|
}
|