From 091e0cf99ac60a1d2ad427fdd549828fda70969a Mon Sep 17 00:00:00 2001
From: "konstantin.kukharenko" <konstantin.kukharenko@demlabs.net>
Date: Mon, 10 Feb 2020 17:00:09 +0000
Subject: [PATCH] Features 3051

---
 auxiliary/Utils.cpp                 | 7 +++++++
 auxiliary/Utils.h                   | 3 +++
 controls/StyledDropShadowEffect.cpp | 6 +++---
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/auxiliary/Utils.cpp b/auxiliary/Utils.cpp
index c273bb5..2a3e601 100644
--- a/auxiliary/Utils.cpp
+++ b/auxiliary/Utils.cpp
@@ -24,4 +24,11 @@ namespace Utils
         }
         return (result.size() == 4) ? QColor(result.at(0), result.at(1), result.at(2), result.at(3)) : QColor();
     }
+
+    int toIntValue(const QString &a_text)
+    {
+        QRegExp regString("(\\d+)");
+        regString.indexIn(a_text);
+        return regString.cap(0).toInt();
+    }
 }
diff --git a/auxiliary/Utils.h b/auxiliary/Utils.h
index a6a1b62..585634c 100644
--- a/auxiliary/Utils.h
+++ b/auxiliary/Utils.h
@@ -6,6 +6,9 @@
 namespace Utils
 {
     QColor toColor(const QString &strRGBA);
+    ///The function returns the first integer in the string.
+    /// 100%=>100 100px=>100 100**=>100 100=>100
+    int toIntValue(const QString &a_text);
 };
 
 #endif // UTILS_H
diff --git a/controls/StyledDropShadowEffect.cpp b/controls/StyledDropShadowEffect.cpp
index 79335d8..a048527 100755
--- a/controls/StyledDropShadowEffect.cpp
+++ b/controls/StyledDropShadowEffect.cpp
@@ -28,11 +28,11 @@ void StyledDropShadowEffect::updateStyle()
     else
         this->setColor(Utils::toColor(colorStr));
 
-    int blur = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "blur").toInt();
+    int blur = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "blur"));
     this->setBlurRadius(blur);
 
     //Offset:
-    int x = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "x").toInt();
-    int y = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "y").toInt();
+    int x = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "x"));
+    int y = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "y"));
     this->setOffset(x, y);
 }
-- 
GitLab