2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#include <QApplication>
|
2019-09-09 14:11:48 +00:00
|
|
|
#include <QScreen>
|
2015-12-08 10:27:45 +00:00
|
|
|
#include <QStyleHints>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <QTranslator>
|
|
|
|
#include <QLocale>
|
|
|
|
#include <QLibraryInfo>
|
|
|
|
|
|
|
|
#include "dialog.h"
|
|
|
|
|
2022-03-18 09:31:16 +00:00
|
|
|
using namespace Qt::StringLiterals;
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
2021-07-07 07:21:35 +00:00
|
|
|
#if QT_CONFIG(translation)
|
|
|
|
QTranslator translator;
|
2022-03-18 09:31:16 +00:00
|
|
|
if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
|
2021-07-07 07:21:35 +00:00
|
|
|
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
|
|
|
|
app.installTranslator(&translator);
|
|
|
|
}
|
2012-12-05 13:40:38 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2021-07-07 07:21:35 +00:00
|
|
|
QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
Dialog dialog;
|
2015-12-08 10:27:45 +00:00
|
|
|
if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
|
2019-09-09 14:11:48 +00:00
|
|
|
const QRect availableGeometry = dialog.screen()->availableGeometry();
|
2015-12-08 10:27:45 +00:00
|
|
|
dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3);
|
|
|
|
dialog.move((availableGeometry.width() - dialog.width()) / 2,
|
|
|
|
(availableGeometry.height() - dialog.height()) / 2);
|
|
|
|
}
|
2011-04-27 17:16:41 +00:00
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
return app.exec();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|