26#include <QGuiApplication>
38 if (QScreen* s = QGuiApplication::primaryScreen())
39 return s->devicePixelRatio();
49 if (
const QScreen* s = w->screen())
50 return s->devicePixelRatio();
60 return static_cast<int>(qRound(logicalPixels *
primaryRatio()));
67 return QSize(
static_cast<int>(qRound(logical.width() * r)),
68 static_cast<int>(qRound(logical.height() * r)));
76 return static_cast<int>(qRound(logicalPixels *
widgetRatio(w)));
qreal widgetRatio(const QWidget *w)
Device pixel ratio of the screen a given widget is currently on.
qreal primaryRatio()
The primary screen's device pixel ratio.
int scaleToPhysical(int logicalPixels)
Scale a logical pixel count into a physical pixel count using the primary screen's DPR.