ExpertManageView.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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->addSpacing(15);
  40. m_vBoxLayout->addWidget(m_expertListWidget);
  41. }
  42. void ExpertManageView::connectSignalsAndSlots()
  43. {
  44. connect(m_addExpertPushButton, &PushButton::clicked, this, &ExpertManageView::slotAddExpertClicked);
  45. }
  46. void ExpertManageView::slotAddExpertClicked()
  47. {
  48. if (m_expertInfoView->isVisible() == false) {
  49. m_expertInfoView->clearInputs();
  50. m_expertInfoView->show();
  51. }
  52. }