Commit b20872ff authored by Stefan Gerlach's avatar Stefan Gerlach

[locale] more fixes in spreadsheet

parent 50059f9e
......@@ -353,21 +353,21 @@ void ColumnPrivate::setColumnMode(AbstractColumn::ColumnMode mode) {
break;
case AbstractColumn::ColumnMode::Numeric:
filter = new String2DoubleFilter();
//TODO: set number locale
static_cast<String2DoubleFilter*>(filter)->setNumberLocale(numberLocale);
filter_is_temporary = true;
temp_col = new Column("temp_col", *(static_cast<QVector<QString>*>(old_data)), m_column_mode);
m_data = new QVector<double>();
break;
case AbstractColumn::ColumnMode::Integer:
filter = new String2IntegerFilter();
//TODO: set number locale
static_cast<String2IntegerFilter*>(filter)->setNumberLocale(numberLocale);
filter_is_temporary = true;
temp_col = new Column("temp_col", *(static_cast<QVector<QString>*>(old_data)), m_column_mode);
m_data = new QVector<int>();
break;
case AbstractColumn::ColumnMode::BigInt:
filter = new String2BigIntFilter();
//TODO: set number locale
static_cast<String2BigIntFilter*>(filter)->setNumberLocale(numberLocale);
filter_is_temporary = true;
temp_col = new Column("temp_col", *(static_cast<QVector<QString>*>(old_data)), m_column_mode);
m_data = new QVector<qint64>();
......
......@@ -44,17 +44,13 @@ bool AbstractFileFilter::isNan(const QString& s) {
return false;
}
AbstractColumn::ColumnMode AbstractFileFilter::columnMode(const QString& valueString, const QString& dateTimeFormat) {
QLocale locale;
return columnMode(valueString, dateTimeFormat, locale);
}
AbstractColumn::ColumnMode AbstractFileFilter::columnMode(const QString& valueString, const QString& dateTimeFormat, QLocale::Language lang) {
QLocale locale(lang);
return columnMode(valueString, dateTimeFormat, locale);
return columnMode(valueString, dateTimeFormat, QLocale(lang));
}
AbstractColumn::ColumnMode AbstractFileFilter::columnMode(const QString& valueString, const QString& dateTimeFormat, const QLocale& locale) {
DEBUG("AbstractFileFilter::columnMode()")
//TODO: use BigInt as default integer?
if (valueString.size() == 0) // empty string treated as integer (meaning the non-empty strings will determine the data type)
......
......@@ -51,9 +51,8 @@ public:
~AbstractFileFilter() override = default;
static bool isNan(const QString&);
static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat);
static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat, QLocale::Language);
static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat, const QLocale&);
static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat, const QLocale& = QLocale());
static QStringList numberFormats();
static AbstractFileFilter::FileType fileType(const QString&);
static QStringList fileTypes();
......
......@@ -1540,7 +1540,7 @@ void SpreadsheetView::pasteIntoSelection() {
// if (!localeDetermined)
// localeDetermined = determineLocale(nonEmptyValue, locale);
const auto mode = AbstractFileFilter::columnMode(nonEmptyValue, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz"));
const auto mode = AbstractFileFilter::columnMode(nonEmptyValue, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz"), numberLocale);
col->setColumnMode(mode);
}
......@@ -1560,7 +1560,7 @@ void SpreadsheetView::pasteIntoSelection() {
// if (!localeDetermined)
// localeDetermined = determineLocale(nonEmptyValue, locale);
const auto mode = AbstractFileFilter::columnMode(nonEmptyValue, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz"));
const auto mode = AbstractFileFilter::columnMode(nonEmptyValue, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz"), numberLocale);
Column* new_col = new Column(QString::number(curCol), mode);
new_col->setPlotDesignation(AbstractColumn::PlotDesignation::Y);
new_col->insertRows(0, m_spreadsheet->rowCount());
......
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