ExpertManageView.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "ExpertManageView.h"
  2. #include "ExpertInfoView.h"
  3. #include "ExpertListWidget.h"
  4. #include <Widgets/Button.h>
  5. #include <Widgets/LineEdit.h>
  6. #include <QBoxLayout>
  7. #include <QLabel>
  8. #include <QDebug>
  9. ExpertManageView::ExpertManageView(QWidget *parent) : QWidget(parent)
  10. {
  11. initialize();
  12. initLayout();
  13. connectSignalsAndSlots();
  14. }
  15. void ExpertManageView::initialize()
  16. {
  17. m_vBoxLayout = new QVBoxLayout(this);
  18. m_titleLabel = new QLabel(this);
  19. m_titleLabel->setText("专家列表");
  20. QFont ft("Microsoft YaHei", 12);
  21. m_titleLabel->setFont(ft);
  22. m_hBoxLayout = new QHBoxLayout();
  23. m_searchLineEdit = new SearchLineEdit(this);
  24. m_searchLineEdit->setPlaceholderText("搜索");
  25. m_searchLineEdit->setMinimumWidth(300);
  26. m_addExpertPushButton = new PushButton("添加", NEWFLICON(FluentIcon, ADD), this);
  27. m_expertInfoView = new ExpertInfoView(this);
  28. m_expertListWidget = new ExpertListWidget(this);
  29. }
  30. void ExpertManageView::initLayout()
  31. {
  32. m_vBoxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
  33. m_vBoxLayout->setContentsMargins(15, 10, 10, 15);
  34. m_vBoxLayout->addLayout(m_hBoxLayout);
  35. m_hBoxLayout->addWidget(m_titleLabel);
  36. m_hBoxLayout->addSpacing(15);
  37. m_hBoxLayout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
  38. m_hBoxLayout->addWidget(m_addExpertPushButton, 1, Qt::AlignLeft);
  39. m_vBoxLayout->addWidget(m_expertListWidget);
  40. }
  41. void ExpertManageView::connectSignalsAndSlots()
  42. {
  43. connect(m_addExpertPushButton, &PushButton::clicked, this, &ExpertManageView::slotAddExpertClicked);
  44. }
  45. void ExpertManageView::slotAddExpertClicked()
  46. {
  47. if (m_expertInfoView->isVisible() == false) {
  48. m_expertInfoView->clearInputs();
  49. m_expertInfoView->show();
  50. }
  51. }