1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 11:52:08 +01:00
GPXSee/src/main.cpp
Martin Tůma 225e6da48b Use the "Round" HiDPI scaling policy (the default in Qt5) in Qt6
As of Qt 6.7.2 the rendering is completely broken and full of various render
artifacts when the default "PassThrough" policy is used and the user has
a fractional screen size like 125% set.
2024-09-21 13:38:56 +02:00

35 lines
943 B
C++

#include <QtGlobal>
#include <QSurfaceFormat>
#include "GUI/app.h"
#include "GUI/timezoneinfo.h"
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
qRegisterMetaTypeStreamOperators<TimeZoneInfo>("TimeZoneInfo");
#else // QT6
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::Round);
#endif // QT6
QSurfaceFormat fmt;
fmt.setProfile(QSurfaceFormat::CoreProfile);
#ifdef Q_OS_ANDROID
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
#else // Android
fmt.setVersion(3, 2);
fmt.setRenderableType(QSurfaceFormat::OpenGL);
#endif // Android
fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8);
fmt.setSamples(4);
QSurfaceFormat::setDefaultFormat(fmt);
App app(argc, argv);
return app.run();
}