#include "HomeView.h" #include "CreateProjView.h" #include "ProjectStateWidget.h" #include #include #include #include #include HomeView::HomeView(QWidget *parent) : QWidget(parent) { initialize(); initLayout(); connectSignalsAndSlots(); // this->setStyleSheet("background-color: rgb(250, 250, 250);"); } void HomeView::initialize() { m_vBoxLayout = new QVBoxLayout(this); m_titleLabel = new QLabel(this); m_titleLabel->setText("工程列表"); QFont ft("Microsoft YaHei", 12); m_titleLabel->setFont(ft); m_hBoxLayout = new QHBoxLayout(); m_searchLineEdit = new SearchLineEdit(this); m_searchLineEdit->setPlaceholderText("搜索工程"); m_searchLineEdit->setMinimumWidth(300); m_createProjPushButton = new PushButton("新建工程", NEWFLICON(FluentIcon, ADD), this); m_projStateWidget = new ProjectStateWidget(this); m_createProjView = new CreateProjView(this); } void HomeView::initLayout() { m_vBoxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_vBoxLayout->setContentsMargins(15, 10, 10, 15); m_vBoxLayout->addLayout(m_hBoxLayout); m_hBoxLayout->addWidget(m_titleLabel); m_hBoxLayout->addSpacing(15); m_hBoxLayout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft); m_hBoxLayout->addWidget(m_createProjPushButton, 1, Qt::AlignLeft); m_vBoxLayout->addWidget(m_projStateWidget); } void HomeView::connectSignalsAndSlots() { connect(m_createProjPushButton, &PushButton::clicked, this, &HomeView::slotCreateProjClicked); } void HomeView::slotCreateProjClicked() { if (m_createProjView->isVisible() == false) { m_createProjView->clearInputs(); m_createProjView->show(); } }