mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-04 02:33:19 +00:00
Format all c++ files
This commit is contained in:
parent
081e107b9b
commit
f8f49233dc
21 changed files with 683 additions and 599 deletions
21
src/main.cpp
21
src/main.cpp
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
/*
|
||||
* Mirai. Copyright (C) 2024 Vyn
|
||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtCore/QRect>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtQml/QQmlApplicationEngine>
|
||||
#include <exception>
|
||||
|
@ -17,7 +17,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
try {
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
|
||||
qreal refDpi = 54.;
|
||||
qreal refHeight = 1440.;
|
||||
qreal refWidth = 2560.;
|
||||
|
@ -25,21 +25,22 @@ int main(int argc, char *argv[])
|
|||
qreal height = qMax(rect.width(), rect.height());
|
||||
qreal width = qMin(rect.width(), rect.height());
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
//auto m_ratio = qMin(height/refHeight, width/refWidth);
|
||||
auto m_ratioFont = qMin(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth));
|
||||
// auto m_ratio = qMin(height/refHeight, width/refWidth);
|
||||
auto m_ratioFont =
|
||||
qMin(height * refDpi / (dpi * refHeight), width * refDpi / (dpi * refWidth));
|
||||
|
||||
QFont font("Helvetica", m_ratioFont);
|
||||
app.setFont(font);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
const QUrl url(u"qrc:/qt/qml/Mirai/src/qml/Main.qml"_qs);
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
||||
&app, []() { QCoreApplication::exit(-1); },
|
||||
Qt::QueuedConnection);
|
||||
QObject::connect(
|
||||
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
|
||||
[]() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
|
||||
engine.load(url);
|
||||
|
||||
return app.exec();
|
||||
} catch (const std::exception& e) {
|
||||
} catch (const std::exception &e) {
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue