EvalWidget.cpp 1.4 KB

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