diff --git a/src/declarativeimports/core/theme.cpp b/src/declarativeimports/core/theme.cpp index 5ac53f35e..ba26631cd 100644 --- a/src/declarativeimports/core/theme.cpp +++ b/src/declarativeimports/core/theme.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include @@ -64,4 +66,26 @@ QQmlPropertyMap *ThemeProxy::iconSizes() const return m_iconSizes; } +int ThemeProxy::dpi(QQuickItem* item) +{ + int _dpi = 1337; + qDebug() << " ----- dpi() ---- "; + if (item) { + QScreen* screen = item->window()->screen(); + if (screen) { + qDebug() << "screen geo: " << screen->availableGeometry(); + _dpi = screen->physicalDotsPerInch(); + qDebug() << " refreshRate : " << screen->refreshRate(); + qDebug() << " devicePixelRatio: " << screen->devicePixelRatio(); + qDebug() << " depth : " << screen->depth(); + qDebug() << " dpi X: " << screen->physicalDotsPerInchX(); + qDebug() << " dpi Y: " << screen->physicalDotsPerInchY(); + qDebug() << " ->> dpi: " << _dpi; + } + } + return _dpi; +} + + + #include "moc_theme.cpp" diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index 4c83d4b84..2bdb1141a 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -57,6 +58,8 @@ public: QQmlPropertyMap *iconSizes() const; + Q_INVOKABLE int dpi(QQuickItem *item); + private Q_SLOTS: void iconLoaderSettingsChanged();