4#ifndef QHIGHDPISCALING_P_H
5#define QHIGHDPISCALING_P_H
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtCore/qlist.h>
20#include <QtCore/qloggingcategory.h>
21#include <QtCore/qmargins.h>
22#include <QtCore/qmath.h>
23#include <QtCore/qrect.h>
24#include <QtGui/qregion.h>
25#include <QtGui/qscreen.h>
26#include <QtGui/qvector2d.h>
27#include <QtGui/qwindow.h>
35typedef QPair<qreal, qreal>
QDpi;
37#ifndef QT_NO_HIGHDPISCALING
47 Q_ENUM(DpiAdjustmentPolicy)
56 static
void initHighDpiScaling();
57 static
void updateHighDpiScaling();
58 static
void setGlobalFactor(
qreal factor);
85 return scaleAndOrigin(
context).factor;
91 static qreal roundScaleFactor(
qreal rawFactor);
105 static QVector<QHighDpiScaling::ScreenFactor> parseScreenScaleFactorsSpec(
const QStringView &screenScaleFactors);
107 static qreal m_factor;
109 static bool m_usePlatformPluginDpi;
110 static bool m_platformPluginDpiScalingActive;
111 static bool m_globalScalingActive;
112 static bool m_screenFactorSet;
113 static bool m_usePhysicalDpi;
114 static QVector<ScreenFactor> m_screenFactors;
115 static DpiAdjustmentPolicy m_dpiAdjustmentPolicy;
116 static QHash<QString, qreal> m_namedScreenScaleFactors;
118#ifndef QT_NO_DEBUG_STREAM
127 return value * scaleFactor;
132 return value * scaleFactor;
137 return value * scaleFactor;
142 return value * float(scaleFactor);
147 return (
pos - origin) * scaleFactor + origin;
152 return (
pos - origin) * scaleFactor + origin;
192 return scaled.translated(origin);
212template <
typename T,
typename C>
219template <
typename T,
typename C>
226template <
typename T,
typename C>
232template <
typename T,
typename C>
238template <
typename T,
typename C>
246template <
typename T,
typename C>
254template <
typename T,
typename C>
262template <
typename T,
typename C>
267 return scale(
value, so.factor, effectiveOrigin);
289 return QRect(nativeScreenGeometry.topLeft(),
308 pointRegion +=
QRectF(
rect.topLeft() / scaleFactor,
rect.size() / scaleFactor).toAlignedRect();
322 static inline void initHighDpiScaling() {}
323 static inline void updateHighDpiScaling() {}
324 static inline void setGlobalFactor(
qreal) {}
327 struct ScaleAndOrigin
332 static ScaleAndOrigin scaleAndOrigin(
const QPlatformScreen *platformScreen,
QPoint *nativePosition =
nullptr);
333 static ScaleAndOrigin scaleAndOrigin(
const QScreen *
screen,
QPoint *nativePosition =
nullptr);
334 static ScaleAndOrigin scaleAndOrigin(
const QWindow *platformScreen,
QPoint *nativePosition =
nullptr);
336 static inline bool isActive() {
return false; }
337 static inline qreal factor(
const QWindow *) {
return 1.0; }
338 static inline qreal factor(
const QScreen *) {
return 1.0; }
350 template <
typename T>
inline
353 template <
typename T>
inline
355 template <
typename T>
inline
358 template <
typename T>
inline
360 template <
typename T>
inline
362 template <
typename T,
typename C>
inline
364 template <
typename T,
typename C>
inline
366 template <
typename T,
typename C>
inline
368 template <
typename T,
typename C>
inline
371 template <
typename T>
inline
373 template <
typename T>
inline
375 template <
typename T>
inline
378 template <
typename T>
inline
381 template <
typename T,
typename U>
inline
383 template <
typename T,
typename U>
inline
Collection of utility functions for UI scaling.
static qreal factor(C *context)
static ScaleAndOrigin scaleAndOrigin(const QPlatformScreen *platformScreen, Point position=Point{ Point::Invalid, QPoint() })
qsizetype size() const noexcept
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
\inmodule QtCore\reentrant
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
QRegion translated(int dx, int dy) const
The QScreen class is used to query screen properties. \inmodule QtGui.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QVector2D class represents a vector or vertex in 2D space.
T toNativePixels(const T &value, const C *context)
QHighDpiScaling::Point position(T, QHighDpiScaling::Point::Kind)
T toNativeLocalPosition(const T &value, const C *context)
T toNativeGlobalPosition(const T &value, const C *context)
T fromNativeLocalPosition(const T &value, const C *context)
T fromNativeGlobalPosition(const T &value, const C *context)
T toNative(const T &value, qreal scaleFactor, QPoint origin=QPoint(0, 0))
QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen)
QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QWindow *window)
QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *window)
T fromNativePixels(const T &value, const C *context)
QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
T fromNative(const T &value, qreal scaleFactor, QPoint origin=QPoint(0, 0))
T toNativeWindowGeometry(const T &value, const C *context)
T fromNativeWindowGeometry(const T &value, const C *context)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
QPair< qreal, qreal > QDpi
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLenum GLenum GLenum GLenum GLenum scale
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QImage scaled(const QImage &image)
[0]