Commit 1d3e2d42 authored by Stefan Gerlach's avatar Stefan Gerlach

[locale] use number locale from settings

parent c2ec5abd
......@@ -71,14 +71,16 @@ constexpr std::add_const_t<T>& qAsConst(T& t) noexcept {
//////////////////////// LineEdit Access ///////////////////////////////
#define SET_INT_FROM_LE(var, le) { \
bool ok; \
const int tmp = QLocale().toInt((le)->text(), &ok); \
SET_NUMBER_LOCALE \
const int tmp = numberLocale.toInt((le)->text(), &ok); \
if (ok) \
var = tmp; \
}
#define SET_DOUBLE_FROM_LE(var, le) { \
bool ok; \
const double tmp = QLocale().toDouble((le)->text(), &ok); \
SET_NUMBER_LOCALE \
const double tmp = numberLocale.toDouble((le)->text(), &ok); \
if (ok) \
var = tmp; \
}
......
......@@ -426,11 +426,13 @@ template QString Matrix::cell<QString>(int row, int col) const;
//! Return the text displayed in the given cell (needs explicit instantiation)
template <typename T>
QString Matrix::text(int row, int col) {
return QLocale().toString(cell<T>(row,col));
SET_NUMBER_LOCALE
return numberLocale.toString(cell<T>(row,col));
}
template <>
QString Matrix::text<double>(int row, int col) {
return QLocale().toString(cell<double>(row,col), d->numericFormat, d->precision);
SET_NUMBER_LOCALE
return numberLocale.toString(cell<double>(row,col), d->numericFormat, d->precision);
}
template <>
QString Matrix::text<QString>(int row, int col) {
......
......@@ -121,6 +121,7 @@ QVariant MatrixModel::data(const QModelIndex& index, int role) const {
QVariant MatrixModel::headerData(int section, Qt::Orientation orientation, int role) const {
QString result;
auto headerFormat = m_matrix->headerFormat();
SET_NUMBER_LOCALE
switch (orientation) {
case Qt::Horizontal:
switch (role) {
......@@ -133,7 +134,7 @@ QVariant MatrixModel::headerData(int section, Qt::Orientation orientation, int r
double step = 0.0;
if (m_matrix->columnCount() > 1)
step = diff/double(m_matrix->columnCount()-1);
result = QLocale().toString(m_matrix->xStart()+double(section)*step,
result = numberLocale.toString(m_matrix->xStart()+double(section)*step,
m_matrix->numericFormat(), m_matrix->precision());
} else {
result = QString::number(section+1) + QLatin1String(" (");
......@@ -141,7 +142,7 @@ QVariant MatrixModel::headerData(int section, Qt::Orientation orientation, int r
double step = 0.0;
if (m_matrix->columnCount() > 1)
step = diff/double(m_matrix->columnCount()-1);
result += QLocale().toString(m_matrix->xStart()+double(section)*step,
result += numberLocale.toString(m_matrix->xStart()+double(section)*step,
m_matrix->numericFormat(), m_matrix->precision());
result += ')';
......@@ -162,9 +163,9 @@ QVariant MatrixModel::headerData(int section, Qt::Orientation orientation, int r
step = diff/double(m_matrix->rowCount()-1);
// TODO: implement decent double == 0 check
// if (diff < 1e-10)
// result += QLocale().toString(m_matrix->yStart(),
// result += numberLocale.toString(m_matrix->yStart(),
// m_matrix->numericFormat(), m_matrix->displayedDigits());
result += QLocale().toString(m_matrix->yStart()+double(section)*step,
result += numberLocale.toString(m_matrix->yStart()+double(section)*step,
m_matrix->numericFormat(), m_matrix->precision());
} else {
result = QString::number(section+1) + QString(" (");
......@@ -173,7 +174,7 @@ QVariant MatrixModel::headerData(int section, Qt::Orientation orientation, int r
if (m_matrix->rowCount() > 1)
step = diff/double(m_matrix->rowCount()-1);
result += QLocale().toString(m_matrix->yStart()+double(section)*step,
result += numberLocale.toString(m_matrix->yStart()+double(section)*step,
m_matrix->numericFormat(), m_matrix->precision());
result += ')';
}
......
......@@ -222,6 +222,7 @@ bool SpreadsheetModel::setData(const QModelIndex& index, const QVariant& value,
//don't do anything if no new value was provided
if (column->columnMode() == AbstractColumn::ColumnMode::Numeric) {
bool ok;
//TODO
QLocale locale;
double new_value = locale.toDouble(value.toString(), &ok);
if (ok) {
......
......@@ -1760,6 +1760,7 @@ void XYCurvePrivate::updateValues() {
//determine the value string for all points that are currently visible in the plot
int i{0};
SET_NUMBER_LOCALE
switch (valuesType) {
case XYCurve::ValuesType::NoValues:
case XYCurve::ValuesType::X: {
......@@ -1771,7 +1772,7 @@ void XYCurvePrivate::updateValues() {
if (!m_pointVisible.at(i++)) continue;
QString value;
if (rangeFormat == CartesianPlot::RangeFormat::Numeric)
value = QLocale().toString(point.x(), valuesNumericFormat, precision);
value = numberLocale.toString(point.x(), valuesNumericFormat, precision);
else
value = QDateTime::fromMSecsSinceEpoch(point.x()).toString(valuesDateTimeFormat);
m_valueStrings << valuesPrefix + value + valuesSuffix;
......@@ -1787,7 +1788,7 @@ void XYCurvePrivate::updateValues() {
if (!m_pointVisible.at(i++)) continue;
QString value;
if (rangeFormat == CartesianPlot::RangeFormat::Numeric)
value = QLocale().toString(point.y(), valuesNumericFormat, precision);
value = numberLocale.toString(point.y(), valuesNumericFormat, precision);
else
value = QDateTime::fromMSecsSinceEpoch(point.y()).toString(valuesDateTimeFormat);
m_valueStrings << valuesPrefix + value + valuesSuffix;
......@@ -1813,12 +1814,12 @@ void XYCurvePrivate::updateValues() {
if (valuesType == XYCurve::ValuesType::XYBracketed)
value = '(';
if (xRangeFormat == CartesianPlot::RangeFormat::Numeric)
value += QLocale().toString(point.x(), valuesNumericFormat, xPrecision);
value += numberLocale.toString(point.x(), valuesNumericFormat, xPrecision);
else
value += QDateTime::fromMSecsSinceEpoch(point.x()).toString(valuesDateTimeFormat);
if (yRangeFormat == CartesianPlot::RangeFormat::Numeric)
value += ',' + QLocale().toString(point.y(), valuesNumericFormat, yPrecision);
value += ',' + numberLocale.toString(point.y(), valuesNumericFormat, yPrecision);
else
value += ',' + QDateTime::fromMSecsSinceEpoch(point.y()).toString(valuesDateTimeFormat);
......@@ -1845,11 +1846,11 @@ void XYCurvePrivate::updateValues() {
switch (xColMode) {
case AbstractColumn::ColumnMode::Numeric:
m_valueStrings << valuesPrefix + QLocale().toString(valuesColumn->valueAt(i), valuesNumericFormat, valuesPrecision) + valuesSuffix;
m_valueStrings << valuesPrefix + numberLocale.toString(valuesColumn->valueAt(i), valuesNumericFormat, valuesPrecision) + valuesSuffix;
break;
case AbstractColumn::ColumnMode::Integer:
case AbstractColumn::ColumnMode::BigInt:
m_valueStrings << valuesPrefix + QLocale().toString(valuesColumn->valueAt(i)) + valuesSuffix;
m_valueStrings << valuesPrefix + numberLocale.toString(valuesColumn->valueAt(i)) + valuesSuffix;
break;
case AbstractColumn::ColumnMode::Text:
m_valueStrings << valuesPrefix + valuesColumn->textAt(i) + valuesSuffix;
......
......@@ -662,11 +662,12 @@ void MatrixView::copySelection() {
WAIT_CURSOR;
QString output_str;
SET_NUMBER_LOCALE
for (int r = 0; r < rows; r++) {
for (int c = 0; c < cols; c++) {
//TODO: mode
if (isCellSelected(first_row + r, first_col + c))
output_str += QLocale().toString(m_matrix->cell<double>(first_row + r, first_col + c),
output_str += numberLocale.toString(m_matrix->cell<double>(first_row + r, first_col + c),
m_matrix->numericFormat(), 16); // copy with max. precision
if (c < cols-1)
output_str += '\t';
......
......@@ -159,6 +159,7 @@ void ImportSQLDatabaseWidget::loadSettings() {
ui.cbImportFrom->setCurrentIndex(config.readEntry("ImportFrom", 0));
importFromChanged(ui.cbImportFrom->currentIndex());
//TODO
const QChar decimalSeparator = QLocale().decimalPoint();
int index = (decimalSeparator == '.') ? 0 : 1;
ui.cbDecimalSeparator->setCurrentIndex(config.readEntry("DecimalSeparator", index));
......
......@@ -600,7 +600,8 @@ void CartesianPlotDock::xMinChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double xMin = QLocale().toDouble(value, &ok);
SET_NUMBER_LOCALE
const double xMin = numberLocale.toDouble(value, &ok);
if (ok) {
for (auto* plot : m_plotList)
plot->setXMin(xMin);
......@@ -613,7 +614,8 @@ void CartesianPlotDock::xMaxChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double xMax = QLocale().toDouble(value, &ok);
SET_NUMBER_LOCALE
const double xMax = numberLocale.toDouble(value, &ok);
if (ok) {
for (auto* plot : m_plotList)
plot->setXMax(xMax);
......@@ -692,7 +694,8 @@ void CartesianPlotDock::yMinChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double yMin = QLocale().toDouble(value, &ok);
SET_NUMBER_LOCALE
const double yMin = numberLocale.toDouble(value, &ok);
if (ok) {
for (auto* plot : m_plotList)
plot->setYMin(yMin);
......@@ -705,7 +708,8 @@ void CartesianPlotDock::yMaxChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double yMax = QLocale().toDouble(value, &ok);
SET_NUMBER_LOCALE
const double yMax = numberLocale.toDouble(value, &ok);
if (ok) {
for (auto* plot : m_plotList)
plot->setYMax(yMax);
......@@ -823,10 +827,11 @@ void CartesianPlotDock::currentXBreakChanged(int index) {
return;
m_initializing = true;
SET_NUMBER_LOCALE
const CartesianPlot::RangeBreak rangeBreak = m_plot->xRangeBreaks().list.at(index);
QString str = std::isnan(rangeBreak.start) ? QString() : QLocale().toString(rangeBreak.start);
QString str = std::isnan(rangeBreak.start) ? QString() : numberLocale.toString(rangeBreak.start);
ui.leXBreakStart->setText(str);
str = std::isnan(rangeBreak.end) ? QString() : QLocale().toString(rangeBreak.end);
str = std::isnan(rangeBreak.end) ? QString() : numberLocale.toString(rangeBreak.end);
ui.leXBreakEnd->setText(str);
ui.sbXBreakPosition->setValue(rangeBreak.position*100);
ui.cbXBreakStyle->setCurrentIndex((int)rangeBreak.style);
......@@ -944,10 +949,11 @@ void CartesianPlotDock::currentYBreakChanged(int index) {
return;
m_initializing = true;
SET_NUMBER_LOCALE
const CartesianPlot::RangeBreak rangeBreak = m_plot->yRangeBreaks().list.at(index);
QString str = std::isnan(rangeBreak.start) ? QString() : QLocale().toString(rangeBreak.start);
QString str = std::isnan(rangeBreak.start) ? QString() : numberLocale.toString(rangeBreak.start);
ui.leYBreakStart->setText(str);
str = std::isnan(rangeBreak.end) ? QString() : QLocale().toString(rangeBreak.end);
str = std::isnan(rangeBreak.end) ? QString() : numberLocale.toString(rangeBreak.end);
ui.leYBreakEnd->setText(str);
ui.sbYBreakPosition->setValue(rangeBreak.position*100);
ui.cbYBreakStyle->setCurrentIndex((int)rangeBreak.style);
......@@ -1399,13 +1405,15 @@ void CartesianPlotDock::plotRangeTypeChanged(CartesianPlot::RangeType type) {
void CartesianPlotDock::plotRangeFirstValuesChanged(int value) {
m_initializing = true;
ui.leRangeFirst->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leRangeFirst->setText(numberLocale.toString(value));
m_initializing = false;
}
void CartesianPlotDock::plotRangeLastValuesChanged(int value) {
m_initializing = true;
ui.leRangeLast->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leRangeLast->setText(numberLocale.toString(value));
m_initializing = false;
}
......@@ -1419,7 +1427,8 @@ void CartesianPlotDock::plotXMinChanged(double value) {
if (m_initializing)
return;
const Lock lock(m_initializing);
ui.leXMin->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leXMin->setText(numberLocale.toString(value));
ui.dateTimeEditXMin->setDateTime(QDateTime::fromMSecsSinceEpoch(value));
}
......@@ -1427,7 +1436,8 @@ void CartesianPlotDock::plotXMaxChanged(double value) {
if (m_initializing)
return;
const Lock lock(m_initializing);
ui.leXMax->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leXMax->setText(numberLocale.toString(value));
ui.dateTimeEditXMax->setDateTime( QDateTime::fromMSecsSinceEpoch(value) );
}
......@@ -1453,7 +1463,8 @@ void CartesianPlotDock::plotYMinChanged(double value) {
if (m_initializing)
return;
const Lock lock(m_initializing);
ui.leYMin->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leYMin->setText(numberLocale.toString(value));
ui.dateTimeEditYMin->setDateTime( QDateTime::fromMSecsSinceEpoch(value) );
}
......@@ -1461,7 +1472,8 @@ void CartesianPlotDock::plotYMaxChanged(double value) {
if (m_initializing)
return;
const Lock lock(m_initializing);
ui.leYMax->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leYMax->setText(numberLocale.toString(value));
ui.dateTimeEditYMax->setDateTime( QDateTime::fromMSecsSinceEpoch(value) );
}
......@@ -1658,12 +1670,13 @@ void CartesianPlotDock::load() {
break;
}
rangeTypeChanged();
ui.leRangeFirst->setText( QLocale().toString(m_plot->rangeFirstValues()) );
ui.leRangeLast->setText( QLocale().toString(m_plot->rangeLastValues()) );
SET_NUMBER_LOCALE
ui.leRangeFirst->setText( numberLocale.toString(m_plot->rangeFirstValues()) );
ui.leRangeLast->setText( numberLocale.toString(m_plot->rangeLastValues()) );
ui.chkAutoScaleX->setChecked(m_plot->autoScaleX());
ui.leXMin->setText(QLocale().toString(m_plot->xMin()));
ui.leXMax->setText(QLocale().toString(m_plot->xMax()));
ui.leXMin->setText(numberLocale.toString(m_plot->xMin()));
ui.leXMax->setText(numberLocale.toString(m_plot->xMax()));
ui.dateTimeEditXMin->setDisplayFormat(m_plot->xRangeDateTimeFormat());
ui.dateTimeEditXMax->setDisplayFormat(m_plot->xRangeDateTimeFormat());
ui.dateTimeEditXMin->setDateTime(QDateTime::fromMSecsSinceEpoch(m_plot->xMin()));
......@@ -1672,8 +1685,8 @@ void CartesianPlotDock::load() {
ui.cbXRangeFormat->setCurrentIndex( (int) m_plot->xRangeFormat() );
ui.chkAutoScaleY->setChecked(m_plot->autoScaleY());
ui.leYMin->setText(QLocale().toString(m_plot->yMin()));
ui.leYMax->setText(QLocale().toString(m_plot->yMax()));
ui.leYMin->setText(numberLocale.toString(m_plot->yMin()));
ui.leYMax->setText(numberLocale.toString(m_plot->yMax()));
ui.dateTimeEditYMin->setDisplayFormat(m_plot->yRangeDateTimeFormat());
ui.dateTimeEditYMax->setDisplayFormat(m_plot->yRangeDateTimeFormat());
ui.dateTimeEditYMin->setDateTime(QDateTime::fromMSecsSinceEpoch(m_plot->yMin()));
......
......@@ -31,11 +31,13 @@
#include "kdefrontend/TemplateHandler.h"
#include "kdefrontend/GuiTools.h"
#include <QPainter>
#include <QDir>
#include <KLocalizedString>
#include <KConfig>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QPainter>
#include <QDir>
CustomPointDock::CustomPointDock(QWidget *parent): BaseDock(parent) {
ui.setupUi(this);
......@@ -165,7 +167,8 @@ void CustomPointDock::positionXChanged() {
return;
bool ok;
double x = QLocale().toDouble(ui.lePositionX->text(), &ok);
SET_NUMBER_LOCALE
double x = numberLocale.toDouble(ui.lePositionX->text(), &ok);
if (ok) {
QPointF pos{m_point->position()};
pos.setX(x);
......@@ -179,7 +182,8 @@ void CustomPointDock::positionYChanged() {
return;
bool ok;
double y = QLocale().toDouble(ui.lePositionY->text(), &ok);
SET_NUMBER_LOCALE
double y = numberLocale.toDouble(ui.lePositionY->text(), &ok);
if (ok) {
QPointF pos{m_point->position()};
pos.setY(y);
......@@ -364,8 +368,9 @@ void CustomPointDock::pointDescriptionChanged(const AbstractAspect* aspect) {
void CustomPointDock::pointPositionChanged(QPointF position) {
m_initializing = true;
ui.lePositionX->setText(QLocale().toString(position.x()));
ui.lePositionY->setText(QLocale().toString(position.y()));
SET_NUMBER_LOCALE
ui.lePositionX->setText(numberLocale.toString(position.x()));
ui.lePositionY->setText(numberLocale.toString(position.y()));
m_initializing = false;
}
......@@ -426,8 +431,9 @@ void CustomPointDock::load() {
m_initializing = true;
ui.lePositionX->setText(QLocale().toString(m_point->position().x()));
ui.lePositionY->setText(QLocale().toString(m_point->position().y()));
SET_NUMBER_LOCALE
ui.lePositionX->setText(numberLocale.toString(m_point->position().x()));
ui.lePositionY->setText(numberLocale.toString(m_point->position().y()));
ui.cbSymbolStyle->setCurrentIndex( (int)m_point->symbolStyle() );
ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(m_point->symbolSize(), Worksheet::Unit::Point) );
......
......@@ -399,14 +399,15 @@ void HistogramDock::setCurves(QList<Histogram*> list) {
ui.leName->setToolTip("");
//show the properties of the first curve
SET_NUMBER_LOCALE
ui.cbType->setCurrentIndex(m_curve->type());
ui.cbOrientation->setCurrentIndex(m_curve->orientation());
ui.cbBinningMethod->setCurrentIndex(m_curve->binningMethod());
ui.sbBinCount->setValue(m_curve->binCount());
ui.leBinWidth->setText(QLocale().toString(m_curve->binWidth()));
ui.leBinWidth->setText(numberLocale.toString(m_curve->binWidth()));
ui.chkAutoBinRanges->setChecked(m_curve->autoBinRanges());
ui.leBinRangesMin->setText( QLocale().toString(m_curve->binRangesMin()) );
ui.leBinRangesMax->setText( QLocale().toString(m_curve->binRangesMax()) );
ui.leBinRangesMin->setText( numberLocale.toString(m_curve->binRangesMin()) );
ui.leBinRangesMax->setText( numberLocale.toString(m_curve->binRangesMax()) );
ui.chkVisible->setChecked( m_curve->isVisible() );
KConfig config(QString(), KConfig::SimpleConfig);
......@@ -577,7 +578,8 @@ void HistogramDock::binWidthChanged() {
const Lock lock(m_initializing);
bool ok;
const double width{QLocale().toDouble(ui.leBinWidth->text(), &ok)};
SET_NUMBER_LOCALE
const double width{numberLocale.toDouble(ui.leBinWidth->text(), &ok)};
if (ok) {
for (auto* curve : m_curvesList)
curve->setBinWidth(width);
......@@ -602,7 +604,8 @@ void HistogramDock::binRangesMinChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double min{QLocale().toDouble(value, &ok)};
SET_NUMBER_LOCALE
const double min{numberLocale.toDouble(value, &ok)};
if (ok) {
for (auto* hist : m_curvesList)
hist->setBinRangesMin(min);
......@@ -615,7 +618,8 @@ void HistogramDock::binRangesMaxChanged(const QString& value) {
const Lock lock(m_initializing);
bool ok;
const double max{QLocale().toDouble(value, &ok)};
SET_NUMBER_LOCALE
const double max{numberLocale.toDouble(value, &ok)};
if (ok) {
for (auto* hist : m_curvesList)
hist->setBinRangesMax(max);
......@@ -1376,7 +1380,8 @@ void HistogramDock::curveBinCountChanged(int count) {
void HistogramDock::curveBinWidthChanged(double width) {
if (m_initializing)return;
const Lock lock(m_initializing);
ui.leBinWidth->setText(QLocale().toString(width));
SET_NUMBER_LOCALE
ui.leBinWidth->setText(numberLocale.toString(width));
}
void HistogramDock::curveAutoBinRangesChanged(bool value) {
......@@ -1388,13 +1393,15 @@ void HistogramDock::curveAutoBinRangesChanged(bool value) {
void HistogramDock::curveBinRangesMinChanged(double value) {
if (m_initializing)return;
const Lock lock(m_initializing);
ui.leBinRangesMin->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leBinRangesMin->setText(numberLocale.toString(value));
}
void HistogramDock::curveBinRangesMaxChanged(double value) {
if (m_initializing)return;
const Lock lock(m_initializing);
ui.leBinRangesMax->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leBinRangesMax->setText(numberLocale.toString(value));
}
//Line-Tab
......
......@@ -30,9 +30,11 @@
#include "commonfrontend/matrix/MatrixView.h"
#include "kdefrontend/TemplateHandler.h"
#include <QDir>
#include <KConfig>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDir>
/*!
\class MatrixDock
......@@ -136,7 +138,8 @@ void MatrixDock::xStartChanged() {
QString str = ui.leXStart->text().trimmed();
if (str.isEmpty()) return;
bool ok;
const double value{ QLocale().toDouble(str, &ok) };
SET_NUMBER_LOCALE
const double value{ numberLocale.toDouble(str, &ok) };
if (ok) {
for (auto* matrix : m_matrixList)
matrix->setXStart(value);
......@@ -150,7 +153,8 @@ void MatrixDock::xEndChanged() {
QString str = ui.leXEnd->text().trimmed();
if (str.isEmpty()) return;
bool ok;
const double value{ QLocale().toDouble(str, &ok) };
SET_NUMBER_LOCALE
const double value{ numberLocale.toDouble(str, &ok) };
if (ok) {
for (auto* matrix : m_matrixList)
matrix->setXEnd(value);
......@@ -164,7 +168,8 @@ void MatrixDock::yStartChanged() {
QString str = ui.leYStart->text().trimmed();
if (str.isEmpty()) return;
bool ok;
const double value{ QLocale().toDouble(str, &ok) };
SET_NUMBER_LOCALE
const double value{ numberLocale.toDouble(str, &ok) };
if (ok) {
for (auto* matrix : m_matrixList)
matrix->setYStart(value);
......@@ -178,7 +183,8 @@ void MatrixDock::yEndChanged() {
QString str = ui.leYEnd->text().trimmed();
if (str.isEmpty()) return;
bool ok;
const double value{ QLocale().toDouble(str, &ok) };
SET_NUMBER_LOCALE
const double value{ numberLocale.toDouble(str, &ok) };
if (ok) {
for (auto* matrix : m_matrixList)
matrix->setYEnd(value);
......@@ -260,25 +266,29 @@ void MatrixDock::matrixColumnCountChanged(int count) {
//mapping to the logical coordinates
void MatrixDock::matrixXStartChanged(double value) {
m_initializing = true;
ui.leXStart->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leXStart->setText(numberLocale.toString(value));
m_initializing = false;
}
void MatrixDock::matrixXEndChanged(double value) {
m_initializing = true;
ui.leXEnd->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leXEnd->setText(numberLocale.toString(value));
m_initializing = false;
}
void MatrixDock::matrixYStartChanged(double value) {
m_initializing = true;
ui.leYStart->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leYStart->setText(numberLocale.toString(value));
m_initializing = false;
}
void MatrixDock::matrixYEndChanged(double value) {
m_initializing = true;
ui.leYEnd->setText(QLocale().toString(value));
SET_NUMBER_LOCALE
ui.leYEnd->setText(numberLocale.toString(value));
m_initializing = false;
}
......@@ -311,10 +321,11 @@ void MatrixDock::load() {
ui.sbColumnCount->setValue(m_matrix->columnCount());
//mapping to the logical coordinates
ui.leXStart->setText(QLocale().toString(m_matrix->xStart()));
ui.leXEnd->setText(QLocale().toString(m_matrix->xEnd()));
ui.leYStart->setText(QLocale().toString(m_matrix->yStart()));
ui.leYEnd->setText(QLocale().toString(m_matrix->yEnd()));
SET_NUMBER_LOCALE
ui.leXStart->setText(numberLocale.toString(m_matrix->xStart()));
ui.leXEnd->setText(numberLocale.toString(m_matrix->xEnd()));
ui.leYStart->setText(numberLocale.toString(m_matrix->yStart()));
ui.leYEnd->setText(numberLocale.toString(m_matrix->yEnd()));
//format
ui.cbFormat->setCurrentIndex(ui.cbFormat->findData((int)m_matrix->numericFormat()));
......@@ -353,10 +364,11 @@ void MatrixDock::loadConfig(KConfig& config) {
ui.sbColumnCount->setValue(group.readEntry("ColumnCount", m_matrix->columnCount()));
//mapping to the logical coordinates
ui.leXStart->setText( QLocale().toString(group.readEntry("XStart", m_matrix->xStart())) );
ui.leXEnd->setText( QLocale().toString(group.readEntry("XEnd", m_matrix->xEnd())) );
ui.leYStart->setText( QLocale().toString(group.readEntry("YStart", m_matrix->yStart())) );
ui.leYEnd->setText( QLocale().toString(group.readEntry("YEnd", m_matrix->yEnd())) );
SET_NUMBER_LOCALE
ui.leXStart->setText( numberLocale.toString(group.readEntry("XStart", m_matrix->xStart())) );
ui.leXEnd->setText( numberLocale.toString(group.readEntry("XEnd", m_matrix->xEnd())) );
ui.leYStart->setText( numberLocale.toString(group.readEntry("YStart", m_matrix->yStart())) );
ui.leYEnd->setText( numberLocale.toString(group.readEntry("YEnd", m_matrix->yEnd())) );
//format
ui.cbFormat->setCurrentIndex( ui.cbFormat->findData(group.readEntry("NumericFormat", QString(m_matrix->numericFormat()))) );
......@@ -375,10 +387,11 @@ void MatrixDock::saveConfigAsTemplate(KConfig& config) {
group.writeEntry("ColumnCount", ui.sbColumnCount->value());
//mapping to the logical coordinates
group.writeEntry("XStart", QLocale().toDouble(ui.leXStart->text()) );
group.writeEntry("XEnd", QLocale().toDouble(ui.leXEnd->text()) );
group.writeEntry("YStart", QLocale().toDouble(ui.leYStart->text()) );
group.writeEntry("YEnd", QLocale().toDouble(ui.leYEnd->text()) );
SET_NUMBER_LOCALE
group.writeEntry("XStart", numberLocale.toDouble(ui.leXStart->text()) );