EvalWidget.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. }
  28. QList<ProjectManager::IndexType> EvalWidget::indexList() const
  29. {
  30. ProjectManager::EvalTypes t = (ProjectManager::EvalTypes)m_type;
  31. return ProjectManager::indexListOfEvalTypes(t);
  32. }
  33. void EvalWidget::setTitle(const QString title)
  34. {
  35. m_title->setText(title);
  36. }
  37. void EvalWidget::initWidgets()
  38. {
  39. m_title = new QLabel(this);
  40. QFont ft("Microsoft YaHei", 12);
  41. m_title->setFont(ft);
  42. // 分割线
  43. m_seperator = new QWidget(this);
  44. m_seperator->setFixedHeight(1);
  45. QPalette pal(m_seperator->palette());
  46. pal.setColor(QPalette::Background, QColor("#aaaaaa"));
  47. m_seperator->setAutoFillBackground(true);
  48. m_seperator->setPalette(pal);
  49. m_tab = new QTabWidget(this);
  50. m_tab->setTabShape(QTabWidget::Rounded);
  51. }
  52. void EvalWidget::initLayout()
  53. {
  54. m_layout = new QVBoxLayout(this);
  55. m_contentLayout = new QHBoxLayout();
  56. m_layout->addWidget(m_title);
  57. m_layout->addWidget(m_seperator);
  58. m_layout->addLayout(m_contentLayout);
  59. m_contentLayout->addWidget(m_tab);
  60. }