#include "customMenu.h"
#include <QGraphicsDropShadowEffect>

CustomMenu::CustomMenu(QWidget* parent)
    :QMenu(parent)
{
    //qss
    setStyleSheet("QMenu{\n"
                  "   margin:2px;\n"
                  "   padding:2px;\n"
                  "   background-color:white;\n"
                  "   border:1px solid #bbbbbb;\n"
                  "}\n"
                  "QMenu:item{\n"
                  "   height:21px;\n"
                  "}\n"
                  "QMenu:item:text{\n"
                  "   padding-left:15px;\n"
                  "   padding-right:15px;\n"
                  "}\n"
                  "QMenu:item:selected{\n"
                  "   background-color:rgb(211,241,250);\n"
                  "}\n");
    //设置阴影
    QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect(this);
    shadow->setBlurRadius(20); //模糊半径
    //shadow->setOffset(15, 15); //偏移量
    shadow->setColor(QColor(0, 0, 0, 50)); //阴影颜色
    setGraphicsEffect(shadow);
}

CustomMenu::~CustomMenu()
{
}
