Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
LabPlot
Commits
4098be08
Commit
4098be08
authored
Jul 09, 2020
by
Stefan Gerlach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[locale] Use general decimal separator for axis tick label
parent
0b831830
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
src/backend/worksheet/plots/cartesian/Axis.cpp
src/backend/worksheet/plots/cartesian/Axis.cpp
+14
-12
No files found.
src/backend/worksheet/plots/cartesian/Axis.cpp
View file @
4098be08
...
...
@@ -40,15 +40,16 @@
// #include "backend/lib/trace.h"
#include "kdefrontend/GuiTools.h"
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QGraphicsSceneContextMenuEvent>
#include <QMenu>
#include <QPainter>
#include <QTextDocument>
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
extern
"C"
{
#include <gsl/gsl_math.h>
#include "backend/nsl/nsl_math.h"
...
...
@@ -1468,45 +1469,46 @@ void AxisPrivate::retransformTickLabelStrings() {
tickLabelStrings
.
clear
();
QString
str
;
SET_NUMBER_LOCALE
if
(
(
orientation
==
Axis
::
Orientation
::
Horizontal
&&
plot
->
xRangeFormat
()
==
CartesianPlot
::
RangeFormat
::
Numeric
)
||
(
orientation
==
Axis
::
Orientation
::
Vertical
&&
plot
->
yRangeFormat
()
==
CartesianPlot
::
RangeFormat
::
Numeric
)
)
{
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
Decimal
)
{
QString
nullStr
=
QString
::
number
(
0
,
'f'
,
labelsPrecision
);
QString
nullStr
=
numberLocale
.
toString
(
0
.
,
'f'
,
labelsPrecision
);
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
QString
::
number
(
value
,
'f'
,
labelsPrecision
);
str
=
numberLocale
.
toString
(
value
,
'f'
,
labelsPrecision
);
if
(
str
==
"-"
+
nullStr
)
str
=
nullStr
;
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
}
else
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
ScientificE
)
{
QString
nullStr
=
QString
::
number
(
0
,
'e'
,
labelsPrecision
);
QString
nullStr
=
numberLocale
.
toString
(
0
.
,
'e'
,
labelsPrecision
);
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
QString
::
number
(
value
,
'e'
,
labelsPrecision
);
str
=
numberLocale
.
toString
(
value
,
'e'
,
labelsPrecision
);
if
(
str
==
"-"
+
nullStr
)
str
=
nullStr
;
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
}
else
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
Powers10
)
{
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
"10<span style=
\"
vertical-align:super
\"
>"
+
QString
::
number
(
log10
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
"10<span style=
\"
vertical-align:super
\"
>"
+
numberLocale
.
toString
(
log10
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
}
else
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
Powers2
)
{
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
"2<span style=
\"
vertical-align:super
\"
>"
+
QString
::
number
(
log2
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
"2<span style=
\"
vertical-align:super
\"
>"
+
numberLocale
.
toString
(
log2
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
}
else
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
PowersE
)
{
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
"e<span style=
\"
vertical-align:super
\"
>"
+
QString
::
number
(
log
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
"e<span style=
\"
vertical-align:super
\"
>"
+
numberLocale
.
toString
(
log
(
value
),
'f'
,
labelsPrecision
)
+
"</span>"
;
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
}
else
if
(
labelsFormat
==
Axis
::
LabelsFormat
::
MultipliesPi
)
{
for
(
const
auto
value
:
tickLabelValues
)
{
str
=
"<span>"
+
QString
::
number
(
value
/
M_PI
,
'f'
,
labelsPrecision
)
+
"</span>"
+
QChar
(
0x03C0
);
str
=
"<span>"
+
numberLocale
.
toString
(
value
/
M_PI
,
'f'
,
labelsPrecision
)
+
"</span>"
+
QChar
(
0x03C0
);
str
=
labelsPrefix
+
str
+
labelsSuffix
;
tickLabelStrings
<<
str
;
}
...
...
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