clNoticePopWidget.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "clNoticePopWidget.h"
  2. #include "ui_clNoticePopWidget.h"
  3. #include "CAppInfo.h"
  4. #include <QGraphicsDropShadowEffect>
  5. clNoticePopWidget::clNoticePopWidget(QWidget *parent) :
  6. QWidget(parent),
  7. ui(new Ui::clNoticePopWidget)
  8. {
  9. ui->setupUi(this);
  10. setStyleSheet(g_appInfoPtr->m_sQssStr);
  11. }
  12. clNoticePopWidget::~clNoticePopWidget()
  13. {
  14. delete ui;
  15. }
  16. void clNoticePopWidget::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
  17. {
  18. setGeometry(nLeft, nTop, nWidth, nHeight);
  19. ui->widget_npw_BG->setGeometry(g_appInfoPtr->m_fRate*5, g_appInfoPtr->m_fRate*5, width()-g_appInfoPtr->m_fRate*10, height()-g_appInfoPtr->m_fRate*10);
  20. ui->label_noticeIcon->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*24,
  21. g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*12);
  22. ui->label_noticeTitle->adjustSize();
  23. ui->label_noticeTitle->setGeometry(ui->label_noticeIcon->x() + ui->label_noticeIcon->width() + g_appInfoPtr->m_fRate*8,
  24. ui->label_noticeIcon->y() + (ui->label_noticeIcon->height() - ui->label_noticeTitle->height())/2,
  25. ui->label_noticeTitle->width(), ui->label_noticeTitle->height());
  26. ui->txtb_noticeContent->setGeometry(ui->label_noticeIcon->x(), ui->label_noticeTitle->y() + ui->label_noticeTitle->height() + g_appInfoPtr->m_fRate*10,
  27. g_appInfoPtr->m_fRate*260, g_appInfoPtr->m_fRate*60);
  28. ui->btn_detail->setGeometry(ui->widget_npw_BG->width() - g_appInfoPtr->m_fRate*(20 + 80),
  29. ui->widget_npw_BG->height() - g_appInfoPtr->m_fRate*(20 + 30),
  30. g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
  31. ui->btn_ignore->setGeometry(ui->btn_detail->x() - g_appInfoPtr->m_fRate*10 - ui->btn_detail->width(), ui->btn_detail->y(),
  32. ui->btn_detail->width(), ui->btn_detail->height());
  33. QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
  34. effect->setOffset(g_appInfoPtr->m_fRate*4,g_appInfoPtr->m_fRate*4);
  35. effect->setColor(QColor(0,0,0,30));
  36. effect->setBlurRadius(g_appInfoPtr->m_fRate*16);
  37. ui->widget_npw_BG->setGraphicsEffect(effect);
  38. }
  39. void clNoticePopWidget::addNotice(const CNoticeInfo ni)
  40. {
  41. vNL.push_back(ni);
  42. }
  43. int clNoticePopWidget::noticeCount()
  44. {
  45. return vNL.size();
  46. }