mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Mode [un]locLengthString() methods to support/qstring_helpers
This commit is contained in:
parent
079bc8ca40
commit
9214f92599
@ -214,22 +214,6 @@ QString formatLocFPNumber(double d)
|
||||
}
|
||||
|
||||
|
||||
QString locLengthString(QString const & str)
|
||||
{
|
||||
QLocale loc;
|
||||
QString res = str;
|
||||
return res.replace(QString("."), loc.decimalPoint());
|
||||
}
|
||||
|
||||
|
||||
QString unlocLengthString(QString const & str)
|
||||
{
|
||||
QLocale loc;
|
||||
QString res = str;
|
||||
return res.replace(loc.decimalPoint(), QString("."));
|
||||
}
|
||||
|
||||
|
||||
bool SortLocaleAware(QString const & lhs, QString const & rhs)
|
||||
{
|
||||
return QString::localeAwareCompare(lhs, rhs) < 0;
|
||||
|
@ -72,12 +72,6 @@ void doubleToWidget(QLineEdit * input, std::string const & value,
|
||||
*/
|
||||
QString formatLocFPNumber(double d);
|
||||
|
||||
/// Method to replace dot with localized decimal separator
|
||||
QString locLengthString(QString const & str);
|
||||
|
||||
/// Method to replace localized decimal separator by dot
|
||||
QString unlocLengthString(QString const & str);
|
||||
|
||||
/// Method to sort QStrings locale-aware (e.g. in combo widgets)
|
||||
bool SortLocaleAware(QString const & lhs, QString const & rhs);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "support/qstring_helpers.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QLocale>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
@ -101,6 +102,26 @@ QString charFilterRegExpC(QString const & filter)
|
||||
return re + ")";
|
||||
}
|
||||
|
||||
QString locLengthString(QString const & str)
|
||||
{
|
||||
QLocale loc;
|
||||
QString res = str;
|
||||
return res.replace(QString("."), loc.decimalPoint());
|
||||
}
|
||||
|
||||
|
||||
docstring locLengthDocString(docstring const str)
|
||||
{
|
||||
return qstring_to_ucs4(locLengthString(toqstr(str)));
|
||||
}
|
||||
|
||||
|
||||
QString unlocLengthString(QString const & str)
|
||||
{
|
||||
QLocale loc;
|
||||
QString res = str;
|
||||
return res.replace(loc.decimalPoint(), QString("."));
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -92,6 +92,15 @@ QString charFilterRegExp(QString const & filter);
|
||||
*/
|
||||
QString charFilterRegExpC(QString const & filter);
|
||||
|
||||
/// Method to replace dot with localized decimal separator
|
||||
QString locLengthString(QString const & str);
|
||||
|
||||
/// Same for doscstring
|
||||
docstring locLengthDocString(docstring const str);
|
||||
|
||||
/// Method to replace localized decimal separator by dot
|
||||
QString unlocLengthString(QString const & str);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QSTRING_HELPERS_H
|
||||
|
Loading…
Reference in New Issue
Block a user