|
@@ -12,14 +12,12 @@
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
-ProjectView::ProjectView(QWidget *parent) : QWidget(parent) { }
|
|
|
+ProjectView::ProjectView(ProjectInfo *proj, QWidget *parent) : QWidget(parent), m_proj(proj) { }
|
|
|
|
|
|
void ProjectView::showEvent(QShowEvent *event)
|
|
|
{
|
|
|
- qDebug() << __FUNCTION__ << __LINE__;
|
|
|
-
|
|
|
if (m_initilized == false) {
|
|
|
- initialize();
|
|
|
+ initWidgets();
|
|
|
initLayout();
|
|
|
connectSigalsAndSlots();
|
|
|
m_initilized = true;
|
|
@@ -33,77 +31,18 @@ void ProjectView::hideEvent(QHideEvent *event)
|
|
|
QWidget::hideEvent(event);
|
|
|
}
|
|
|
|
|
|
-void ProjectView::initialize()
|
|
|
+ProjectInfo *ProjectView::proj() const
|
|
|
{
|
|
|
- m_hBoxLayout = new QHBoxLayout(this);
|
|
|
-
|
|
|
- m_listWidget = new QWidget(this);
|
|
|
- m_listWidget->setFixedWidth(260);
|
|
|
-
|
|
|
- QPalette pal(m_listWidget->palette());
|
|
|
- pal.setColor(QPalette::Background, QColor("#f3f3f3"));
|
|
|
- m_listWidget->setAutoFillBackground(true);
|
|
|
- m_listWidget->setPalette(pal);
|
|
|
-
|
|
|
- m_listLayout = new QVBoxLayout(m_listWidget);
|
|
|
-
|
|
|
- m_buttonLayout = new QHBoxLayout();
|
|
|
- m_searchLineEdit = new LineEdit(this);
|
|
|
- m_searchLineEdit->setIsClearButtonEnabled(true);
|
|
|
- m_searchLineEdit->setPlaceholderText("搜索工程");
|
|
|
- m_renameButton = new ToolButton(NEWFLICON(FluentIcon, EDIT), this);
|
|
|
- m_renameButton->setToolTip("修改工程名");
|
|
|
- m_newProjButton = new ToolButton(NEWFLICON(FluentIcon, ADD), this);
|
|
|
- m_newProjButton->setToolTip("新建工程");
|
|
|
- m_deleteButton = new ToolButton(NEWFLICON(FluentIcon, DELETE), this);
|
|
|
- m_deleteButton->setToolTip("删除工程");
|
|
|
-
|
|
|
- m_projListWidget = new ProjectListWidget(this);
|
|
|
-
|
|
|
- m_projDetailWidget = new QWidget(this);
|
|
|
- m_projLayout = new QVBoxLayout(m_projDetailWidget);
|
|
|
-
|
|
|
- m_projNameLabel = new QLabel(this);
|
|
|
- m_projNameLabel->setObjectName("projNameLabel");
|
|
|
- m_projNameLabel->setText("工程1-技术方案评估");
|
|
|
-
|
|
|
- m_separator = new QWidget(this);
|
|
|
- m_separator->setFixedWidth(1);
|
|
|
- m_separator->setStyleSheet("background-color:#dddddd");
|
|
|
-
|
|
|
- m_configExpWidget = new ConfigExpertWidget(this);
|
|
|
- m_configExpWidget->setFixedWidth(260);
|
|
|
+ return m_proj;
|
|
|
}
|
|
|
|
|
|
-void ProjectView::initLayout()
|
|
|
+void ProjectView::setProject(ProjectInfo *proj)
|
|
|
{
|
|
|
- m_hBoxLayout->setMargin(0);
|
|
|
- m_hBoxLayout->setSpacing(0);
|
|
|
-
|
|
|
- m_hBoxLayout->addWidget(m_listWidget);
|
|
|
-
|
|
|
- m_listLayout->addLayout(m_buttonLayout);
|
|
|
- m_buttonLayout->addWidget(m_searchLineEdit);
|
|
|
- m_buttonLayout->addWidget(m_newProjButton);
|
|
|
- m_buttonLayout->addWidget(m_renameButton);
|
|
|
- m_buttonLayout->addWidget(m_deleteButton);
|
|
|
-
|
|
|
- m_listLayout->addWidget(m_projListWidget);
|
|
|
-
|
|
|
- m_hBoxLayout->addWidget(m_projDetailWidget);
|
|
|
-
|
|
|
- m_projLayout->addWidget(m_projNameLabel);
|
|
|
- m_projLayout->addStretch();
|
|
|
-
|
|
|
- m_hBoxLayout->addWidget(m_separator, Qt::AlignRight);
|
|
|
- m_hBoxLayout->addWidget(m_configExpWidget, Qt::AlignRight);
|
|
|
-
|
|
|
- setStyleSheet("#projNameLabel {font-size:20px;font:bold;color:#333333}");
|
|
|
+ m_proj = proj;
|
|
|
}
|
|
|
|
|
|
-void ProjectView::connectSigalsAndSlots()
|
|
|
-{
|
|
|
- connect(m_renameButton, &ToolButton::clicked, this, &ProjectView::showRenameWidget);
|
|
|
-}
|
|
|
+void ProjectView::initWidgets() { }
|
|
|
+
|
|
|
+void ProjectView::initLayout() { }
|
|
|
|
|
|
-void ProjectView::showRenameWidget() { }
|
|
|
+void ProjectView::connectSigalsAndSlots() { }
|