EvalWidget.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "EvalWidget.h"
  2. #include <QLabel>
  3. #include <QLayout>
  4. #include <QDebug>
  5. EvalWidget::EvalWidget(ProjectInfo *proj, int type, QWidget *parent) : QWidget(parent), m_proj(proj), m_type(type)
  6. {
  7. initWidgets();
  8. initLayout();
  9. }
  10. ProjectInfo *EvalWidget::proj() const
  11. {
  12. return m_proj;
  13. }
  14. void EvalWidget::setProject(ProjectInfo *proj)
  15. {
  16. m_proj = proj;
  17. }
  18. int EvalWidget::type() const
  19. {
  20. return m_type;
  21. }
  22. void EvalWidget::setType(int type)
  23. {
  24. m_type = type;
  25. }
  26. void EvalWidget::setTitle(const QString title)
  27. {
  28. m_title->setText(title);
  29. }
  30. void EvalWidget::initWidgets()
  31. {
  32. m_title = new QLabel(this);
  33. QFont ft("Microsoft YaHei", 12);
  34. m_title->setFont(ft);
  35. // 分割线
  36. m_seperator = new QWidget(this);
  37. m_seperator->setFixedHeight(1);
  38. QPalette pal(m_seperator->palette());
  39. pal.setColor(QPalette::Background, QColor("#aaaaaa"));
  40. m_seperator->setAutoFillBackground(true);
  41. m_seperator->setPalette(pal);
  42. }
  43. void EvalWidget::initLayout()
  44. {
  45. m_layout = new QVBoxLayout(this);
  46. m_contentLayout = new QVBoxLayout();
  47. m_layout->addWidget(m_title);
  48. m_layout->addWidget(m_seperator);
  49. m_layout->addLayout(m_contentLayout);
  50. }