clNoticeDetail.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "clNoticeDetail.h"
  2. #include "ui_clNoticeDetail.h"
  3. #include "CAppInfo.h"
  4. clNoticeDetail::clNoticeDetail(CNoticeInfo ni, QWidget *parent) :
  5. QWidget(parent),
  6. ui(new Ui::clNoticeDetail), m_ni(ni)
  7. {
  8. ui->setupUi(this);
  9. setStyleSheet(g_appInfoPtr->m_sQssStr);
  10. }
  11. clNoticeDetail::~clNoticeDetail()
  12. {
  13. delete ui;
  14. }
  15. void clNoticeDetail::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
  16. {
  17. if (m_ni.bHasRecalled)
  18. {
  19. ui->label_clnd_title->setText(QString::fromLocal8Bit("发送者已撤回消息:%1").arg(m_ni.sTitle));
  20. ui->txtb_noticeContent->insertPlainText(QString::fromLocal8Bit("该消息已经被发送者撤回。"));
  21. }
  22. else
  23. {
  24. ui->label_clnd_title->setText(m_ni.sTitle);
  25. ui->txtb_noticeContent->insertHtml(m_ni.sContent);
  26. }
  27. setGeometry(nLeft, nTop, nWidth, nHeight);
  28. ui->widget_offlineExam->setGeometry(0, 0, width(), height());
  29. ui->widget_op_top->setGeometry(0, 0, width(), g_appInfoPtr->m_fRate*72);
  30. ui->btn_gobackList->setGeometry(ui->widget_op_top->width() - g_appInfoPtr->m_fRate*30 - g_appInfoPtr->m_fRate*108,
  31. (ui->widget_op_top->height() - g_appInfoPtr->m_fRate*32)/2,
  32. g_appInfoPtr->m_fRate*108, g_appInfoPtr->m_fRate*32);
  33. ui->btn_gobackList->setIconSize(QSize(g_appInfoPtr->m_fRate*14, g_appInfoPtr->m_fRate*14));
  34. ui->btn_gobackList->setIcon(QIcon(":/images/icon-goback-list.png"));
  35. ui->widget_clnd_client->setGeometry(0, ui->widget_op_top->height(), width(), height() - ui->widget_op_top->height());
  36. ui->label_clnd_title->adjustSize();
  37. ui->label_clnd_title->setGeometry((ui->widget_clnd_client->width() - ui->label_clnd_title->width())/2,
  38. g_appInfoPtr->m_fRate*30, ui->label_clnd_title->width(), ui->label_clnd_title->height());
  39. ui->label_clnd_time->setText(m_ni.sPublishTime);
  40. ui->label_clnd_time->adjustSize();
  41. ui->label_clnd_time->setGeometry((ui->widget_clnd_client->width() - ui->label_clnd_time->width())/2,
  42. ui->label_clnd_title->y() + ui->label_clnd_title->height() + g_appInfoPtr->m_fRate*10, ui->label_clnd_time->width(), ui->label_clnd_time->height());
  43. ui->label_HLine->setGeometry(g_appInfoPtr->m_fRate*30, ui->label_clnd_time->y() + ui->label_clnd_time->height() + g_appInfoPtr->m_fRate*30,
  44. ui->widget_clnd_client->width() - g_appInfoPtr->m_fRate*30*2, g_appInfoPtr->m_fRate*1 < 1 ? 1 : g_appInfoPtr->m_fRate*1);
  45. ui->txtb_noticeContent->setGeometry(ui->label_HLine->x(), ui->label_HLine->y() + ui->label_HLine->height() + g_appInfoPtr->m_fRate*16,
  46. ui->label_HLine->width(), ui->widget_clnd_client->height() - ui->label_HLine->y() - g_appInfoPtr->m_fRate*(16 + 16 + 1));
  47. }
  48. void clNoticeDetail::on_btn_gobackList_clicked()
  49. {
  50. emit gobackNoticeList();
  51. }