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
Utilities
KCalc
Commits
2752eca5
Commit
2752eca5
authored
Mar 24, 2021
by
Laurent Montel
😁
Browse files
Fix build with unity support
parent
191a9997
Changes
1
Hide whitespace changes
Inline
Side-by-side
kcalc_const_menu.cpp
View file @
2752eca5
...
...
@@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KLocalizedString>
namespace
{
QList
<
science_constant
>
Constant
s
;
QList
<
science_constant
>
science
Constant
List
;
ConstantCategory
stringToCategory
(
const
QString
&
s
)
{
if
(
s
==
QLatin1String
(
"mathematics"
))
{
...
...
@@ -94,7 +94,7 @@ void KCalcConstMenu::init_consts() {
tmp_const
.
category
=
stringToCategory
(
tmp_str_category
);
tmp_const
.
whatsthis
=
e
.
firstChildElement
(
QStringLiteral
(
"description"
)).
text
();
Constant
s
.
append
(
tmp_const
);
science
Constant
List
.
append
(
tmp_const
);
}
n
=
n
.
nextSibling
();
i
++
;
...
...
@@ -112,18 +112,18 @@ void KCalcConstMenu::init_all()
connect
(
this
,
&
KCalcConstMenu
::
triggered
,
this
,
&
KCalcConstMenu
::
slotPassSignalThrough
);
for
(
int
i
=
0
;
i
<
Constant
s
.
size
();
i
++
)
{
QAction
*
tmp_action
=
new
QAction
(
i18n
(
Constant
s
.
at
(
i
).
name
.
toLatin1
().
data
()),
this
);
for
(
int
i
=
0
;
i
<
science
Constant
List
.
size
();
i
++
)
{
QAction
*
tmp_action
=
new
QAction
(
i18n
(
science
Constant
List
.
at
(
i
).
name
.
toLatin1
().
data
()),
this
);
tmp_action
->
setData
(
QVariant
(
i
));
if
(
Constant
s
.
at
(
i
).
category
&
Mathematics
)
if
(
science
Constant
List
.
at
(
i
).
category
&
Mathematics
)
math_menu
->
addAction
(
tmp_action
);
if
(
Constant
s
.
at
(
i
).
category
&
Electromagnetic
)
if
(
science
Constant
List
.
at
(
i
).
category
&
Electromagnetic
)
em_menu
->
addAction
(
tmp_action
);
if
(
Constant
s
.
at
(
i
).
category
&
Nuclear
)
if
(
science
Constant
List
.
at
(
i
).
category
&
Nuclear
)
nuclear_menu
->
addAction
(
tmp_action
);
if
(
Constant
s
.
at
(
i
).
category
&
Thermodynamics
)
if
(
science
Constant
List
.
at
(
i
).
category
&
Thermodynamics
)
thermo_menu
->
addAction
(
tmp_action
);
if
(
Constant
s
.
at
(
i
).
category
&
Gravitation
)
if
(
science
Constant
List
.
at
(
i
).
category
&
Gravitation
)
gravitation_menu
->
addAction
(
tmp_action
);
}
}
...
...
@@ -132,7 +132,7 @@ void KCalcConstMenu::slotPassSignalThrough(QAction *chosen_const)
{
bool
tmp_bool
;
int
chosen_const_idx
=
(
chosen_const
->
data
()).
toInt
(
&
tmp_bool
);
emit
triggeredConstant
(
Constant
s
.
at
(
chosen_const_idx
));
emit
triggeredConstant
(
science
Constant
List
.
at
(
chosen_const_idx
));
}
KCalcConstMenu
::
KCalcConstMenu
(
const
QString
&
title
,
QWidget
*
parent
)
...
...
Write
Preview
Markdown
is supported
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