#include "HomeView.h" #include "CreateProjView.h" #include #include #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_projTableWidget = new QTableWidget(this); m_projTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); m_projTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); m_projTableWidget->setSelectionMode(QAbstractItemView::NoSelection); m_projTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); m_projTableWidget->verticalHeader()->setVisible(false); const QStringList headers = { "工程名", "工程类型", "专家信息", "评估状态" }; m_projTableWidget->setColumnCount(headers.count()); m_projTableWidget->setHorizontalHeaderLabels(headers); m_projTableWidget->setStyleSheet("border: 1px solid rgba(0, 0, 0, 0.073)"); 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->addSpacing(15); m_vBoxLayout->addWidget(m_projTableWidget); } 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(); } }