Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Telemetry
KUserFeedback
Commits
37fe53b7
Commit
37fe53b7
authored
Jan 04, 2017
by
Volker Krause
Browse files
Add screen dpi value to screen info source
parent
2767c8ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
analyzer/schematemplates/screens.schema
View file @
37fe53b7
...
...
@@ -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" } ] }
]
}
provider/core/screeninfosource.cpp
View file @
37fe53b7
...
...
@@ -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
...
...
tests/auto/datasourcetest.cpp
View file @
37fe53b7
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment