Commit 876a3500 authored by Alexander Semke's avatar Alexander Semke

Automatically update locale dependent widgets in Axis, Curve and Label...

Automatically update locale dependent widgets in Axis, Curve and Label properties widgets on settings changes.
parent 50827d7b
......@@ -423,17 +423,7 @@ void AxisDock::setAxes(QList<Axis*> list) {
labelWidget->setAxes(list);
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);
updateLocale();
//if there are more then one axis in the list, disable the tab "general"
if (list.size() == 1) {
......@@ -519,6 +509,21 @@ void AxisDock::setAxes(QList<Axis*> list) {
connect(m_axis, &Axis::visibilityChanged, this, &AxisDock::axisVisibilityChanged);
}
void AxisDock::updateLocale() {
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();
}
void AxisDock::activateTitleTab() {
ui.tabWidget->setCurrentWidget(ui.tabTitle);
}
......@@ -641,7 +646,7 @@ void AxisDock::positionChanged() {
const double offset{numberLocale.toDouble(ui.lePosition->text(), &ok)};
if (ok) {
for (auto* axis : m_axesList)
axis->setOffset(offset);
axis->setOffset(offset);
}
}
......
......@@ -50,6 +50,7 @@ public:
void setAxes(QList<Axis*>);
void activateTitleTab();
void updateLocale() override;
private:
Ui::AxisDock ui;
......
......@@ -577,16 +577,7 @@ void XYCurveDock::setCurves(QList<XYCurve*> list) {
Q_ASSERT(m_curve);
m_aspectTreeModel = new AspectTreeModel(m_curve->project());
setModel();
SET_NUMBER_LOCALE
ui.sbLineWidth->setLocale(numberLocale);
ui.sbDropLineWidth->setLocale(numberLocale);
ui.sbSymbolSize->setLocale(numberLocale);
ui.sbSymbolBorderWidth->setLocale(numberLocale);
ui.sbValuesDistance->setLocale(numberLocale);
ui.sbErrorBarsCapSize->setLocale(numberLocale);
ui.sbErrorBarsWidth->setLocale(numberLocale);
updateLocale();
initGeneralTab();
initTabs();
m_initializing = false;
......@@ -757,6 +748,17 @@ void XYCurveDock::setModelIndexFromAspect(TreeViewComboBox* cb, const AbstractAs
cb->setCurrentModelIndex(QModelIndex());
}
void XYCurveDock::updateLocale() {
SET_NUMBER_LOCALE
ui.sbLineWidth->setLocale(numberLocale);
ui.sbDropLineWidth->setLocale(numberLocale);
ui.sbSymbolSize->setLocale(numberLocale);
ui.sbSymbolBorderWidth->setLocale(numberLocale);
ui.sbValuesDistance->setLocale(numberLocale);
ui.sbErrorBarsCapSize->setLocale(numberLocale);
ui.sbErrorBarsWidth->setLocale(numberLocale);
}
//*************************************************************
//********** SLOTs for changes triggered in XYCurveDock ********
//*************************************************************
......
......@@ -53,6 +53,7 @@ public:
void setCurves(QList<XYCurve*>);
virtual void setupGeneral();
void checkColumnAvailability(TreeViewComboBox*, const AbstractColumn*, const QString& columnPath);
void updateLocale() override;
private:
virtual void initGeneralTab();
......
......@@ -225,6 +225,7 @@ void LabelWidget::setLabels(QList<TextLabel*> labels) {
this->load();
initConnections();
updateBackground();
updateLocale();
}
void LabelWidget::setAxes(QList<Axis*> axes) {
......@@ -236,19 +237,13 @@ void LabelWidget::setAxes(QList<Axis*> axes) {
connect(axis->title(), &TextLabel::rotationAngleChanged, this, &LabelWidget::labelRotationAngleChanged );
}
SET_NUMBER_LOCALE
ui.sbPositionX->setLocale(numberLocale);
ui.sbPositionY->setLocale(numberLocale);
ui.sbOffsetX->setLocale(numberLocale);
ui.sbOffsetY->setLocale(numberLocale);
ui.sbBorderWidth->setLocale(numberLocale);
m_axesList = axes;
m_label = m_labelsList.first();
this->load();
initConnections();
updateBackground();
updateLocale();
}
/*!
......@@ -403,6 +398,15 @@ void LabelWidget::updateUnits() {
ui.sbPositionY->setSuffix(suffix);
}
void LabelWidget::updateLocale() {
SET_NUMBER_LOCALE
ui.sbPositionX->setLocale(numberLocale);
ui.sbPositionY->setLocale(numberLocale);
ui.sbOffsetX->setLocale(numberLocale);
ui.sbOffsetY->setLocale(numberLocale);
ui.sbBorderWidth->setLocale(numberLocale);
}
//**********************************************************
//****** SLOTs for changes triggered in LabelWidget ********
//**********************************************************
......
......@@ -54,6 +54,7 @@ public:
void setLabels(QList<TextLabel*>);
void setAxes(QList<Axis*>);
void updateUnits();
void updateLocale();
void load();
void loadConfig(KConfigGroup&);
......
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