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
Plasma
Plasma Add-ons
Commits
158386f7
Commit
158386f7
authored
Oct 09, 2020
by
Alexander Lohnau
💬
Browse files
ConverterRunner: Avoid temporary containers and detaching
parent
89ee12f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
runners/converter/converterrunner.cpp
View file @
158386f7
...
...
@@ -180,9 +180,9 @@ QList<KUnitConversion::Unit> ConverterRunner::createResultUnits(QString &outputU
}
else
{
// Autocompletion for the target units
outputUnitString
=
outputUnitString
.
toUpper
();
for
(
const
auto
&
unitStringKey
:
compatibleUnits
.
keys
()
)
{
if
(
unitStringKey
.
startsWith
(
outputUnitString
))
{
outputUnit
=
category
.
unit
(
compatibleUn
it
s
.
value
(
unitStringKey
));
for
(
auto
it
=
compatibleUnits
.
constBegin
();
it
!=
compatibleUnits
.
constEnd
();
it
++
)
{
if
(
it
.
key
()
.
startsWith
(
outputUnitString
))
{
outputUnit
=
category
.
unit
(
it
.
value
());
if
(
!
units
.
contains
(
outputUnit
))
{
units
<<
outputUnit
;
}
...
...
@@ -226,8 +226,10 @@ void ConverterRunner::insertCompatibleUnits()
}
// Add all units as uppercase in the map
for
(
const
auto
&
category
:
converter
.
categories
())
{
for
(
const
auto
&
unit
:
category
.
allUnits
())
{
const
auto
categories
=
converter
.
categories
();
for
(
const
auto
&
category
:
categories
)
{
const
auto
allUnits
=
category
.
allUnits
();
for
(
const
auto
&
unit
:
allUnits
)
{
compatibleUnits
.
insert
(
unit
.
toUpper
(),
unit
);
}
}
...
...
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