mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-06 09:15:23 +08:00
6.5.3 clean
This commit is contained in:
36
tests/manual/examples/widgets/richtext/textedit/main.cpp
Normal file
36
tests/manual/examples/widgets/richtext/textedit/main.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "textedit.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QScreen>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QCoreApplication::setOrganizationName("QtProject");
|
||||
QCoreApplication::setApplicationName("Rich Text");
|
||||
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("file", "The file to open.");
|
||||
parser.process(a);
|
||||
|
||||
TextEdit mw;
|
||||
|
||||
const QRect availableGeometry = mw.screen()->availableGeometry();
|
||||
mw.resize(availableGeometry.width() / 2, (availableGeometry.height() * 2) / 3);
|
||||
mw.move((availableGeometry.width() - mw.width()) / 2,
|
||||
(availableGeometry.height() - mw.height()) / 2);
|
||||
|
||||
if (!mw.load(parser.positionalArguments().value(0, QLatin1String(":/example.html"))))
|
||||
mw.fileNew();
|
||||
|
||||
mw.show();
|
||||
return a.exec();
|
||||
}
|
Reference in New Issue
Block a user