#include "dropshadowmgr.h" #include "idropshadowable.h" DropShadowMgr::DropShadowMgrGarbo DropShadowMgr::garbo; DropShadowMgr* DropShadowMgr::sm_pInstance = new DropShadowMgr(nullptr); //初始化静态单例(饿汉): QList DropShadowMgr::sm_cacheShadows; bool DropShadowMgr::eventFilter(QObject *watched, QEvent *event) { IDropShadowable *pDropShadowableObj = dynamic_cast(watched); if(pDropShadowableObj == nullptr) { return QObject::eventFilter(watched, event); } if(event->type() == QEvent::Paint) { pDropShadowableObj->PaintShadows(); } return QObject::eventFilter(watched, event); }