12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include "HomeView.h"
- #include "CreateProjView.h"
- #include "ProjectStateWidget.h"
- #include <Widgets/Button.h>
- #include <Widgets/LineEdit.h>
- #include <QBoxLayout>
- #include <QLabel>
- #include <QDebug>
- 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();
- }
- }
|