commit 9214f925992d61d0471e8ab401a07e2aeb8db750
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue Aug 9 17:27:53 2022 +0200

    Mode [un]locLengthString() methods to support/qstring_helpers
---
 src/frontends/qt/qt_helpers.cpp |   16 ----------------
 src/frontends/qt/qt_helpers.h   |    6 ------
 src/support/qstring_helpers.cpp |   21 +++++++++++++++++++++
 src/support/qstring_helpers.h   |    9 +++++++++
 4 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index db39b4c..0431c04 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -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;
diff --git a/src/frontends/qt/qt_helpers.h b/src/frontends/qt/qt_helpers.h
index 07812c3..08d50fa 100644
--- a/src/frontends/qt/qt_helpers.h
+++ b/src/frontends/qt/qt_helpers.h
@@ -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);
 
diff --git a/src/support/qstring_helpers.cpp b/src/support/qstring_helpers.cpp
index bb800f3..fadca76 100644
--- a/src/support/qstring_helpers.cpp
+++ b/src/support/qstring_helpers.cpp
@@ -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
diff --git a/src/support/qstring_helpers.h b/src/support/qstring_helpers.h
index e33131c..905343e 100644
--- a/src/support/qstring_helpers.h
+++ b/src/support/qstring_helpers.h
@@ -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
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to