Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
LabPlot
Commits
4de64b34
Commit
4de64b34
authored
Jul 04, 2020
by
Stefan Gerlach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[plot] Fix using system locale in range line edits
parent
0617ab9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
25 deletions
+50
-25
src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
+50
-25
No files found.
src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
View file @
4de64b34
...
@@ -599,9 +599,13 @@ void CartesianPlotDock::xMinChanged(const QString& value) {
...
@@ -599,9 +599,13 @@ void CartesianPlotDock::xMinChanged(const QString& value) {
return
;
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
const
float
min
=
value
.
toDouble
();
const
QLocale
locale
{
QLocale
::
system
()};
for
(
auto
*
plot
:
m_plotList
)
bool
ok
;
plot
->
setXMin
(
min
);
const
double
xMin
=
locale
.
toDouble
(
value
,
&
ok
);
if
(
ok
)
{
for
(
auto
*
plot
:
m_plotList
)
plot
->
setXMin
(
xMin
);
}
}
}
void
CartesianPlotDock
::
xMaxChanged
(
const
QString
&
value
)
{
void
CartesianPlotDock
::
xMaxChanged
(
const
QString
&
value
)
{
...
@@ -609,9 +613,13 @@ void CartesianPlotDock::xMaxChanged(const QString& value) {
...
@@ -609,9 +613,13 @@ void CartesianPlotDock::xMaxChanged(const QString& value) {
return
;
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
const
float
max
=
value
.
toDouble
();
const
QLocale
locale
{
QLocale
::
system
()};
for
(
auto
*
plot
:
m_plotList
)
bool
ok
;
plot
->
setXMax
(
max
);
const
double
xMax
=
locale
.
toDouble
(
value
,
&
ok
);
if
(
ok
)
{
for
(
auto
*
plot
:
m_plotList
)
plot
->
setXMax
(
xMax
);
}
}
}
void
CartesianPlotDock
::
xMinDateTimeChanged
(
const
QDateTime
&
dateTime
)
{
void
CartesianPlotDock
::
xMinDateTimeChanged
(
const
QDateTime
&
dateTime
)
{
...
@@ -685,9 +693,13 @@ void CartesianPlotDock::yMinChanged(const QString& value) {
...
@@ -685,9 +693,13 @@ void CartesianPlotDock::yMinChanged(const QString& value) {
return
;
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
const
float
min
=
value
.
toDouble
();
const
QLocale
locale
{
QLocale
::
system
()};
for
(
auto
*
plot
:
m_plotList
)
bool
ok
;
plot
->
setYMin
(
min
);
const
double
yMin
=
locale
.
toDouble
(
value
,
&
ok
);
if
(
ok
)
{
for
(
auto
*
plot
:
m_plotList
)
plot
->
setYMin
(
yMin
);
}
}
}
void
CartesianPlotDock
::
yMaxChanged
(
const
QString
&
value
)
{
void
CartesianPlotDock
::
yMaxChanged
(
const
QString
&
value
)
{
...
@@ -695,9 +707,13 @@ void CartesianPlotDock::yMaxChanged(const QString& value) {
...
@@ -695,9 +707,13 @@ void CartesianPlotDock::yMaxChanged(const QString& value) {
return
;
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
const
float
max
=
value
.
toDouble
();
const
QLocale
locale
{
QLocale
::
system
()};
for
(
auto
*
plot
:
m_plotList
)
bool
ok
;
plot
->
setYMax
(
max
);
const
double
yMax
=
locale
.
toDouble
(
value
,
&
ok
);
if
(
ok
)
{
for
(
auto
*
plot
:
m_plotList
)
plot
->
setYMax
(
yMax
);
}
}
}
void
CartesianPlotDock
::
yMinDateTimeChanged
(
const
QDateTime
&
dateTime
)
{
void
CartesianPlotDock
::
yMinDateTimeChanged
(
const
QDateTime
&
dateTime
)
{
...
@@ -1404,16 +1420,20 @@ void CartesianPlotDock::plotXAutoScaleChanged(bool value) {
...
@@ -1404,16 +1420,20 @@ void CartesianPlotDock::plotXAutoScaleChanged(bool value) {
}
}
void
CartesianPlotDock
::
plotXMinChanged
(
double
value
)
{
void
CartesianPlotDock
::
plotXMinChanged
(
double
value
)
{
if
(
m_initializing
)
return
;
if
(
m_initializing
)
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
ui
.
leXMin
->
setText
(
QString
::
number
(
value
)
);
const
QLocale
locale
{
QLocale
::
system
()};
ui
.
dateTimeEditXMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
ui
.
leXMin
->
setText
(
locale
.
toString
(
value
));
ui
.
dateTimeEditXMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
));
}
}
void
CartesianPlotDock
::
plotXMaxChanged
(
double
value
)
{
void
CartesianPlotDock
::
plotXMaxChanged
(
double
value
)
{
if
(
m_initializing
)
return
;
if
(
m_initializing
)
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
ui
.
leXMax
->
setText
(
QString
::
number
(
value
)
);
const
QLocale
locale
{
QLocale
::
system
()};
ui
.
leXMax
->
setText
(
locale
.
toString
(
value
));
ui
.
dateTimeEditXMax
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
ui
.
dateTimeEditXMax
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
}
}
...
@@ -1436,16 +1456,20 @@ void CartesianPlotDock::plotYAutoScaleChanged(bool value) {
...
@@ -1436,16 +1456,20 @@ void CartesianPlotDock::plotYAutoScaleChanged(bool value) {
}
}
void
CartesianPlotDock
::
plotYMinChanged
(
double
value
)
{
void
CartesianPlotDock
::
plotYMinChanged
(
double
value
)
{
if
(
m_initializing
)
return
;
if
(
m_initializing
)
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
ui
.
leYMin
->
setText
(
QString
::
number
(
value
)
);
const
QLocale
locale
{
QLocale
::
system
()};
ui
.
leYMin
->
setText
(
locale
.
toString
(
value
));
ui
.
dateTimeEditYMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
ui
.
dateTimeEditYMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
}
}
void
CartesianPlotDock
::
plotYMaxChanged
(
double
value
)
{
void
CartesianPlotDock
::
plotYMaxChanged
(
double
value
)
{
if
(
m_initializing
)
return
;
if
(
m_initializing
)
return
;
const
Lock
lock
(
m_initializing
);
const
Lock
lock
(
m_initializing
);
ui
.
leYMax
->
setText
(
QString
::
number
(
value
)
);
const
QLocale
locale
{
QLocale
::
system
()};
ui
.
leYMax
->
setText
(
locale
.
toString
(
value
));
ui
.
dateTimeEditYMax
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
ui
.
dateTimeEditYMax
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
value
)
);
}
}
...
@@ -1646,8 +1670,9 @@ void CartesianPlotDock::load() {
...
@@ -1646,8 +1670,9 @@ void CartesianPlotDock::load() {
ui
.
leRangeLast
->
setText
(
QString
::
number
(
m_plot
->
rangeLastValues
())
);
ui
.
leRangeLast
->
setText
(
QString
::
number
(
m_plot
->
rangeLastValues
())
);
ui
.
chkAutoScaleX
->
setChecked
(
m_plot
->
autoScaleX
());
ui
.
chkAutoScaleX
->
setChecked
(
m_plot
->
autoScaleX
());
ui
.
leXMin
->
setText
(
QString
::
number
(
m_plot
->
xMin
())
);
const
QLocale
locale
{
QLocale
::
system
()};
ui
.
leXMax
->
setText
(
QString
::
number
(
m_plot
->
xMax
())
);
ui
.
leXMin
->
setText
(
locale
.
toString
(
m_plot
->
xMin
()));
ui
.
leXMax
->
setText
(
locale
.
toString
(
m_plot
->
xMax
()));
ui
.
dateTimeEditXMin
->
setDisplayFormat
(
m_plot
->
xRangeDateTimeFormat
());
ui
.
dateTimeEditXMin
->
setDisplayFormat
(
m_plot
->
xRangeDateTimeFormat
());
ui
.
dateTimeEditXMax
->
setDisplayFormat
(
m_plot
->
xRangeDateTimeFormat
());
ui
.
dateTimeEditXMax
->
setDisplayFormat
(
m_plot
->
xRangeDateTimeFormat
());
ui
.
dateTimeEditXMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
m_plot
->
xMin
()));
ui
.
dateTimeEditXMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
m_plot
->
xMin
()));
...
@@ -1656,8 +1681,8 @@ void CartesianPlotDock::load() {
...
@@ -1656,8 +1681,8 @@ void CartesianPlotDock::load() {
ui
.
cbXRangeFormat
->
setCurrentIndex
(
(
int
)
m_plot
->
xRangeFormat
()
);
ui
.
cbXRangeFormat
->
setCurrentIndex
(
(
int
)
m_plot
->
xRangeFormat
()
);
ui
.
chkAutoScaleY
->
setChecked
(
m_plot
->
autoScaleY
());
ui
.
chkAutoScaleY
->
setChecked
(
m_plot
->
autoScaleY
());
ui
.
leYMin
->
setText
(
QString
::
number
(
m_plot
->
yMin
())
);
ui
.
leYMin
->
setText
(
locale
.
toString
(
m_plot
->
yMin
()));
ui
.
leYMax
->
setText
(
QString
::
number
(
m_plot
->
yMax
())
);
ui
.
leYMax
->
setText
(
locale
.
toString
(
m_plot
->
yMax
()));
ui
.
dateTimeEditYMin
->
setDisplayFormat
(
m_plot
->
yRangeDateTimeFormat
());
ui
.
dateTimeEditYMin
->
setDisplayFormat
(
m_plot
->
yRangeDateTimeFormat
());
ui
.
dateTimeEditYMax
->
setDisplayFormat
(
m_plot
->
yRangeDateTimeFormat
());
ui
.
dateTimeEditYMax
->
setDisplayFormat
(
m_plot
->
yRangeDateTimeFormat
());
ui
.
dateTimeEditYMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
m_plot
->
yMin
()));
ui
.
dateTimeEditYMin
->
setDateTime
(
QDateTime
::
fromMSecsSinceEpoch
(
m_plot
->
yMin
()));
...
...
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