Skip to content
Snippets Groups Projects
StyledDropShadowEffect.cpp 1.24 KiB
Newer Older
#include "StyledDropShadowEffect.h"
/** @brief constructor. Update style
 *  @param a_parent object parent
*/
StyledDropShadowEffect::StyledDropShadowEffect(QObject *a_parent /*= Q_NULLPTR*/)
    :QGraphicsDropShadowEffect(a_parent)
{
    this->updateStyle();
}

/** @brief get stylesheet from app and update shadow style
*/
void StyledDropShadowEffect::updateStyle()
{
    StyleSheatSearchPar searchPar;
    searchPar.widgetName = "#" + parent()->objectName();
    searchPar.subcontrol = "shadow";
    QString stylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
    QString colorStr = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "color");
    if (colorStr.isEmpty())
        this->setColor(QColor(0,0,0,0));
    else
        this->setColor(Utils::toColor(colorStr));

konstantin.kukharenko's avatar
konstantin.kukharenko committed
    int blur = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "blur"));
    this->setBlurRadius(blur);

konstantin.kukharenko's avatar
konstantin.kukharenko committed
    int x = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "x"));
    int y = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "y"));
    this->setOffset(x, y);