diff --git a/CMakeLists.txt b/CMakeLists.txt index bc3535b..0c87e25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models") set(META_VERSION_MAJOR 6) -set(META_VERSION_MINOR 1) +set(META_VERSION_MINOR 2) set(META_VERSION_PATCH 0) set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}) diff --git a/resources/resources.cpp b/resources/resources.cpp index 98c9fdd..7c18507 100644 --- a/resources/resources.cpp +++ b/resources/resources.cpp @@ -298,4 +298,18 @@ bool hasCoreApp() } } // namespace ApplicationInstances +/*! + * \brief Sets Qt application attributes which are commonly used within my Qt applications. + * \remarks + * - So far this enables High-DPI support. + * - The exact attributes are unspecified and might change to whatever makes sense in the future. + */ +void setupCommonQtApplicationAttributes() +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); +} + +// namespace ApplicationInstances + } // namespace QtUtilities diff --git a/resources/resources.h b/resources/resources.h index 2deb30d..ec9272e 100644 --- a/resources/resources.h +++ b/resources/resources.h @@ -12,14 +12,16 @@ QT_FORWARD_DECLARE_CLASS(QStringList) QT_FORWARD_DECLARE_CLASS(QSettings) /*! - * \brief Sets the application meta data in the QCoreApplication singleton. + * \brief Sets the application meta data in the QCoreApplication singleton and attributes commonly used + * within my applications. + * \sa ::QtUtilities::setupCommonQtApplicationAttributes() */ #define SET_QT_APPLICATION_INFO \ QCoreApplication::setOrganizationName(QStringLiteral(APP_AUTHOR)); \ QCoreApplication::setOrganizationDomain(QStringLiteral(APP_DOMAIN)); \ QCoreApplication::setApplicationName(QStringLiteral(APP_NAME)); \ QCoreApplication::setApplicationVersion(QStringLiteral(APP_VERSION)); \ - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true) + ::QtUtilities::setupCommonQtApplicationAttributes() /*! * \brief Loads translations for Qt, other dependencies and the application. @@ -59,6 +61,8 @@ QT_UTILITIES_EXPORT bool hasGuiApp(); QT_UTILITIES_EXPORT bool hasCoreApp(); } // namespace ApplicationInstances +QT_UTILITIES_EXPORT void setupCommonQtApplicationAttributes(); + } // namespace QtUtilities #endif // APPLICATION_UTILITIES_RESOURCES_H