Commit 37fe53b7 authored by Volker Krause's avatar Volker Krause
Browse files

Add screen dpi value to screen info source

parent 2767c8ce
......@@ -13,6 +13,10 @@
{
"name": "height",
"type": "int"
},
{
"name": "dpi",
"type": "int"
}
]
}
......@@ -22,6 +26,7 @@
{ "type": "xy", "elements": [
{ "type": "value", "schemaEntry": "screens", "schemaEntryElement": "width" },
{ "type": "value", "schemaEntry": "screens", "schemaEntryElement": "height" }
] }
] },
{ "type": "numeric", "elements": [ { "type": "value", "schemaEntry": "screens", "schemaEntryElement": "dpi" } ] }
]
}
......@@ -38,6 +38,7 @@ QVariant ScreenInfoSource::data()
QVariantMap m;
m.insert(QStringLiteral("width"), screen->size().width());
m.insert(QStringLiteral("height"), screen->size().height());
m.insert(QStringLiteral("dpi"), qRound(screen->physicalDotsPerInch()));
l.push_back(m);
}
#endif
......
......@@ -80,6 +80,15 @@ private slots:
QVERIFY(v.canConvert<QVariantList>());
auto a = v.value<QVariantList>();
QVERIFY(a.size() > 0);
for (int i = 0; i < a.size(); ++i) {
v = a.at(i);
QVERIFY(v.canConvert<QVariantMap>());
const auto scr = v.toMap();
QVERIFY(scr.contains(QLatin1String("height")));
QVERIFY(scr.contains(QLatin1String("width")));
QVERIFY(scr.contains(QLatin1String("dpi")));
}
}
void testPropertyRatioSource()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment