]> git.lyx.org Git - features.git/commitdiff
Mode [un]locLengthString() methods to support/qstring_helpers
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 9 Aug 2022 15:27:53 +0000 (17:27 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 9 Aug 2022 15:27:53 +0000 (17:27 +0200)
src/frontends/qt/qt_helpers.cpp
src/frontends/qt/qt_helpers.h
src/support/qstring_helpers.cpp
src/support/qstring_helpers.h

index db39b4c5f0bcfbe7bbeb0d2d59ac8788bacf7e4e..0431c042ad1c1c69658fe8e8e5e0c7ed1db24734 100644 (file)
@@ -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;
index 07812c3d922ca9db6f5c67949deb0de41e1807a6..08d50fa582b5cd411bdff09bc6bbe1e9303b4ce6 100644 (file)
@@ -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);
 
index bb800f3c67eeda9d84897efd9f99b9bac4a7c928..fadca76a657eb5cdfa13b3738dd59269d4911e8d 100644 (file)
@@ -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
index e33131caa594053b5ba4b06ff32c6fcbbbca5613..905343e77d568d164055dcc0c609bc6127a48dbf 100644 (file)
@@ -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