16 #include <QGuiApplication>
26 , mScreenDensity( calculateScreenDensity() )
32 return mScreenDensity;
35 qreal QgsQuickUtils::calculateScreenDensity()
40 const QWindowList windows = QGuiApplication::topLevelWindows();
41 if ( !windows.isEmpty() )
43 QScreen *screen = windows.at( 0 )->screen();
44 double dpiX = screen->physicalDotsPerInchX();
45 double dpiY = screen->physicalDotsPerInchY();
46 dpi = dpiX < dpiY ? dpiX : dpiY;
qreal screenDensity() const
"dp" is useful for building building components that work well with different screen densities.
QgsQuickUtils(QObject *parent=nullptr)
Create new utilities.