Skip to content
GitLab
Menu
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
6b699202
Commit
6b699202
authored
Dec 22, 2016
by
Volker Krause
Browse files
Fix data format of the property ratio source
parent
58f81a74
Changes
2
Hide whitespace changes
Inline
Side-by-side
provider/core/propertyratiosource.cpp
View file @
6b699202
...
...
@@ -134,8 +134,11 @@ QVariant PropertyRatioSource::data()
for
(
auto
it
=
d
->
ratioSet
.
constBegin
();
it
!=
d
->
ratioSet
.
constEnd
();
++
it
)
total
+=
it
.
value
();
for
(
auto
it
=
d
->
ratioSet
.
constBegin
();
it
!=
d
->
ratioSet
.
constEnd
();
++
it
)
m
.
insert
(
it
.
key
(),
(
double
)
it
.
value
()
/
(
double
)(
total
));
for
(
auto
it
=
d
->
ratioSet
.
constBegin
();
it
!=
d
->
ratioSet
.
constEnd
();
++
it
)
{
QVariantMap
v
;
v
.
insert
(
QStringLiteral
(
"property"
),
(
double
)
it
.
value
()
/
(
double
)(
total
));
m
.
insert
(
it
.
key
(),
v
);
}
return
m
;
}
...
...
tests/auto/datasourcetest.cpp
View file @
6b699202
...
...
@@ -99,7 +99,7 @@ private slots:
o
=
v
.
toMap
();
QCOMPARE
(
o
.
size
(),
1
);
QVERIFY
(
o
.
contains
(
QLatin1String
(
"value1"
)));
v
=
o
.
value
(
QLatin1String
(
"value1"
));
v
=
o
.
value
(
QLatin1String
(
"value1"
))
.
toMap
().
value
(
QLatin1String
(
"property"
));
;
QCOMPARE
(
v
.
type
(),
QVariant
::
Double
);
setProp
(
23
);
...
...
@@ -108,7 +108,7 @@ private slots:
o
=
v
.
toMap
();
QCOMPARE
(
o
.
size
(),
2
);
QVERIFY
(
o
.
contains
(
QLatin1String
(
"value2"
)));
v
=
o
.
value
(
QLatin1String
(
"value2"
));
v
=
o
.
value
(
QLatin1String
(
"value2"
))
.
toMap
().
value
(
QLatin1String
(
"property"
))
;
QCOMPARE
(
v
.
type
(),
QVariant
::
Double
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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