Commit 6a51387c authored by Alexander Semke's avatar Alexander Semke

Properly update the locale in QLineEdit widgets in Plot and Axis

properties widgets.
parent 3ace9550
......@@ -423,7 +423,19 @@ void AxisDock::setAxes(QList<Axis*> list) {
labelWidget->setAxes(list);
updateLocale();
//set the current locale
SET_NUMBER_LOCALE
ui.sbLineWidth->setLocale(numberLocale);
ui.sbMajorTicksSpacingNumeric->setLocale(numberLocale);
ui.sbMajorTicksWidth->setLocale(numberLocale);
ui.sbMajorTicksLength->setLocale(numberLocale);
ui.sbMinorTicksSpacingNumeric->setLocale(numberLocale);
ui.sbMinorTicksWidth->setLocale(numberLocale);
ui.sbMinorTicksLength->setLocale(numberLocale);
ui.sbLabelsOffset->setLocale(numberLocale);
ui.sbMajorGridWidth->setLocale(numberLocale);
ui.sbMinorGridWidth->setLocale(numberLocale);
labelWidget->updateLocale();
//if there are more then one axis in the list, disable the tab "general"
if (list.size() == 1) {
......@@ -509,6 +521,9 @@ void AxisDock::setAxes(QList<Axis*> list) {
connect(m_axis, &Axis::visibilityChanged, this, &AxisDock::axisVisibilityChanged);
}
/*
* updates the locale in the widgets. called when the application settins are changed.
*/
void AxisDock::updateLocale() {
SET_NUMBER_LOCALE
ui.sbLineWidth->setLocale(numberLocale);
......@@ -521,6 +536,14 @@ void AxisDock::updateLocale() {
ui.sbLabelsOffset->setLocale(numberLocale);
ui.sbMajorGridWidth->setLocale(numberLocale);
ui.sbMinorGridWidth->setLocale(numberLocale);
//update the QLineEdits, avoid the change events
Lock lock(m_initializing);
ui.lePosition->setText(numberLocale.toString(m_axis->offset()));
ui.leStart->setText(numberLocale.toString(m_axis->start()));
ui.leEnd->setText(numberLocale.toString(m_axis->end()));
//update the title label
labelWidget->updateLocale();
}
......
......@@ -285,7 +285,19 @@ void CartesianPlotDock::setPlots(QList<CartesianPlot*> list) {
labelWidget->setLabels(labels);
updateLocale();
//set the current locale
SET_NUMBER_LOCALE
ui.sbLeft->setLocale(numberLocale);
ui.sbTop->setLocale(numberLocale);
ui.sbWidth->setLocale(numberLocale);
ui.sbHeight->setLocale(numberLocale);
ui.sbBorderWidth->setLocale(numberLocale);
ui.sbBorderCornerRadius->setLocale(numberLocale);
ui.sbPaddingHorizontal->setLocale(numberLocale);
ui.sbPaddingVertical->setLocale(numberLocale);
ui.sbPaddingRight->setLocale(numberLocale);
ui.sbPaddingBottom->setLocale(numberLocale);
labelWidget->updateLocale();
//if there is more then one plot in the list, disable the name and comment fields in the tab "general"
if (list.size() == 1) {
......@@ -378,8 +390,13 @@ void CartesianPlotDock::activateTitleTab() {
ui.tabWidget->setCurrentWidget(ui.tabTitle);
}
/*
* updates the locale in the widgets. called when the application settins are changed.
*/
void CartesianPlotDock::updateLocale() {
SET_NUMBER_LOCALE
//update the QSpinBoxes
ui.sbLeft->setLocale(numberLocale);
ui.sbTop->setLocale(numberLocale);
ui.sbWidth->setLocale(numberLocale);
......@@ -390,6 +407,18 @@ void CartesianPlotDock::updateLocale() {
ui.sbPaddingVertical->setLocale(numberLocale);
ui.sbPaddingRight->setLocale(numberLocale);
ui.sbPaddingBottom->setLocale(numberLocale);
//update the QLineEdits, avoid the change events
Lock lock(m_initializing);
ui.leRangeFirst->setText(numberLocale.toString(m_plot->rangeFirstValues()));
ui.leRangeLast->setText(numberLocale.toString(m_plot->rangeLastValues()));
ui.leXMin->setText(numberLocale.toString(m_plot->xMin()));
ui.leXMax->setText(numberLocale.toString(m_plot->xMax()));
ui.leYMin->setText(numberLocale.toString(m_plot->yMin()));
ui.leYMax->setText(numberLocale.toString(m_plot->yMax()));
//update the title label
labelWidget->updateLocale();
}
void CartesianPlotDock::updateUnits() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment