diff --git a/src/common/QskFunctions.cpp b/src/common/QskFunctions.cpp index f10c7572..229c2bfa 100644 --- a/src/common/QskFunctions.cpp +++ b/src/common/QskFunctions.cpp @@ -4,6 +4,14 @@ #include #include +QSK_QT_PRIVATE_BEGIN +#include +#include +QSK_QT_PRIVATE_END + +#include +#include + template< class Rect, class Value > static inline Rect qskAlignedRect( const Rect& outerRect, Value width, Value height, Qt::Alignment alignment ) @@ -138,3 +146,26 @@ qreal qskDpiScaled( qreal value ) return value * factor; } + +qreal qskGlobalScaleFactor() +{ + // The value of QT_SCALE_FACTOR + const QScreen* noScreen = nullptr; + return QHighDpiScaling::factor( noScreen ); +} + +bool qskHasPlatformWindowManagement() +{ + if ( auto platform = QGuiApplicationPrivate::platformIntegration() ) + return platform->hasCapability( QPlatformIntegration::WindowManagement ); + + return false; +} + +QRect qskPlatformScreenGeometry( const QScreen* screen ) +{ + if ( screen == nullptr ) + return QRect(); + + return screen->handle()->geometry(); +} diff --git a/src/common/QskFunctions.h b/src/common/QskFunctions.h index 9f189a00..18c3ab78 100644 --- a/src/common/QskFunctions.h +++ b/src/common/QskFunctions.h @@ -11,7 +11,12 @@ #include #include +class QScreen; + QSK_EXPORT qreal qskDpiScaled( qreal value ); +QSK_EXPORT qreal qskGlobalScaleFactor(); +QSK_EXPORT bool qskHasPlatformWindowManagement(); +QSK_EXPORT QRect qskPlatformScreenGeometry( const QScreen* ); QSK_EXPORT QRect qskAlignedRect( const QRect& outerRect, int width, int height, Qt::Alignment alignment );