dropshadowmgr.cpp 672 B

1234567891011121314151617181920
  1. #include "dropshadowmgr.h"
  2. #include "idropshadowable.h"
  3. DropShadowMgr::DropShadowMgrGarbo DropShadowMgr::garbo;
  4. DropShadowMgr* DropShadowMgr::sm_pInstance = new DropShadowMgr(nullptr); //初始化静态单例(饿汉):
  5. QList<BoxShadow> DropShadowMgr::sm_cacheShadows;
  6. bool DropShadowMgr::eventFilter(QObject *watched, QEvent *event)
  7. {
  8. IDropShadowable *pDropShadowableObj = dynamic_cast<IDropShadowable*>(watched);
  9. if(pDropShadowableObj == nullptr)
  10. {
  11. return QObject::eventFilter(watched, event);
  12. }
  13. if(event->type() == QEvent::Paint)
  14. {
  15. pDropShadowableObj->PaintShadows();
  16. }
  17. return QObject::eventFilter(watched, event);
  18. }