EXEvalView.cpp 1.6 KB

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