EXEvalView.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. m_tab->setStyleSheet("QTabWidget#tabWidget{background-color:rgb(255,0,0);}\
  53. QTabBar::tab{background-color:rgb(211,211,211);color:rgb(0,0,0);}\
  54. QTabBar::tab::selected{background-color:rgb(155,155,155);color:rgb(255,255,255);}");
  55. }
  56. void EXEvalView::initLayout()
  57. {
  58. m_layout = new QVBoxLayout(this);
  59. m_topLayout = new QHBoxLayout();
  60. m_layout->addLayout(m_topLayout);
  61. m_layout->addWidget(m_seperator);
  62. m_contentLayout = new QHBoxLayout();
  63. m_layout->addLayout(m_contentLayout);
  64. m_topLayout->addWidget(m_title);
  65. m_contentLayout->addWidget(m_tab);
  66. }