HomeView.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "HomeView.h"
  2. #include <Widgets/Button.h>
  3. #include <Widgets/LineEdit.h>
  4. #include <QBoxLayout>
  5. #include <QLabel>
  6. HomeView::HomeView(QWidget *parent) : QWidget(parent)
  7. {
  8. initialize();
  9. initLayout();
  10. connectSignalsAndSlots();
  11. // this->setStyleSheet("background-color: rgb(250, 250, 250);");
  12. }
  13. void HomeView::initialize()
  14. {
  15. m_vBoxLayout = new QVBoxLayout(this);
  16. m_titleLabel = new QLabel(this);
  17. m_titleLabel->setText("工程列表");
  18. QFont ft("Microsoft YaHei", 12);
  19. m_titleLabel->setFont(ft);
  20. m_hBoxLayout = new QHBoxLayout();
  21. m_searchLineEdit = new SearchLineEdit(this);
  22. m_searchLineEdit->setPlaceholderText("搜索工程");
  23. m_searchLineEdit->setMinimumWidth(300);
  24. m_createProjPushButton = new PushButton("新建工程", NEWFLICON(FluentIcon, ADD), this);
  25. }
  26. void HomeView::initLayout()
  27. {
  28. m_vBoxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
  29. m_vBoxLayout->setContentsMargins(100, 10, 0, 0);
  30. m_vBoxLayout->addLayout(m_hBoxLayout);
  31. m_hBoxLayout->addSpacing(10);
  32. m_hBoxLayout->addWidget(m_titleLabel);
  33. m_hBoxLayout->addSpacing(15);
  34. m_hBoxLayout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
  35. m_hBoxLayout->addWidget(m_createProjPushButton, 1, Qt::AlignLeft);
  36. }
  37. void HomeView::connectSignalsAndSlots() { }