12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "clNoticePopWidget.h"
- #include "ui_clNoticePopWidget.h"
- #include "CAppInfo.h"
- #include <QGraphicsDropShadowEffect>
- clNoticePopWidget::clNoticePopWidget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::clNoticePopWidget)
- {
- ui->setupUi(this);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- }
- clNoticePopWidget::~clNoticePopWidget()
- {
- delete ui;
- }
- void clNoticePopWidget::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
- {
- setGeometry(nLeft, nTop, nWidth, nHeight);
- 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);
- ui->label_noticeIcon->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*24,
- g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*12);
- ui->label_noticeTitle->adjustSize();
- ui->label_noticeTitle->setGeometry(ui->label_noticeIcon->x() + ui->label_noticeIcon->width() + g_appInfoPtr->m_fRate*8,
- ui->label_noticeIcon->y() + (ui->label_noticeIcon->height() - ui->label_noticeTitle->height())/2,
- ui->label_noticeTitle->width(), ui->label_noticeTitle->height());
- ui->txtb_noticeContent->setGeometry(ui->label_noticeIcon->x(), ui->label_noticeTitle->y() + ui->label_noticeTitle->height() + g_appInfoPtr->m_fRate*10,
- g_appInfoPtr->m_fRate*260, g_appInfoPtr->m_fRate*60);
- ui->btn_detail->setGeometry(ui->widget_npw_BG->width() - g_appInfoPtr->m_fRate*(20 + 80),
- ui->widget_npw_BG->height() - g_appInfoPtr->m_fRate*(20 + 30),
- g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
- ui->btn_ignore->setGeometry(ui->btn_detail->x() - g_appInfoPtr->m_fRate*10 - ui->btn_detail->width(), ui->btn_detail->y(),
- ui->btn_detail->width(), ui->btn_detail->height());
- QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
- effect->setOffset(g_appInfoPtr->m_fRate*4,g_appInfoPtr->m_fRate*4);
- effect->setColor(QColor(0,0,0,30));
- effect->setBlurRadius(g_appInfoPtr->m_fRate*16);
- ui->widget_npw_BG->setGraphicsEffect(effect);
- }
- void clNoticePopWidget::addNotice(const CNoticeInfo ni)
- {
- vNL.push_back(ni);
- }
- int clNoticePopWidget::noticeCount()
- {
- return vNL.size();
- }
|