diff --git a/auxiliary/Utils.cpp b/auxiliary/Utils.cpp index c273bb5d448bb9837a03aa83aa145bc4053005ad..2a3e6011691cad75ed6b7a0c2947a638bcc0f0c8 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 a6a1b62dad0ddcf6a9431f93aa673c90662a6690..585634c70274d2462fdac9726dd09409428c3ced 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 79335d84680319f769b556be3a19e411db9b8dc8..a048527063be81a23c3dc37c32c3235f3e3aed9a 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); }