|
@@ -1,10 +1,13 @@
|
|
|
#include "ExpertManageView.h"
|
|
|
|
|
|
+#include "QFDIcon.h"
|
|
|
+
|
|
|
#include "ExpertInfoWidget.h"
|
|
|
#include "ExpertListWidget.h"
|
|
|
|
|
|
#include <Widgets/Button.h>
|
|
|
#include <Widgets/LineEdit.h>
|
|
|
+#include <DialogBox/Dialog.h>
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
#include <QLabel>
|
|
@@ -31,8 +34,10 @@ void ExpertManageView::initialize()
|
|
|
m_searchLineEdit->setPlaceholderText("搜索");
|
|
|
m_searchLineEdit->setMinimumWidth(300);
|
|
|
m_addExpertPushButton = new PushButton("添加", NEWFLICON(FluentIcon, ADD), this);
|
|
|
+ m_detailPushButton = new PushButton("查看详情", NEWFLICON(QFDIcon, Detail), this);
|
|
|
+ m_deletePushButton = new PushButton("删除", NEWFLICON(FluentIcon, DELETE), this);
|
|
|
|
|
|
- m_expertInfoWidget = new ExpertInfoWidget(this);
|
|
|
+ m_expertInfoWidget = new ExpertInfoWidget(this);
|
|
|
m_expertListWidget = new ExpertListWidget(this);
|
|
|
}
|
|
|
|
|
@@ -42,10 +47,15 @@ void ExpertManageView::initLayout()
|
|
|
m_vBoxLayout->setContentsMargins(15, 10, 10, 15);
|
|
|
m_vBoxLayout->addLayout(m_hBoxLayout);
|
|
|
|
|
|
+ m_hBoxLayout->setContentsMargins(10, 0, 10, 0);
|
|
|
m_hBoxLayout->addWidget(m_titleLabel);
|
|
|
m_hBoxLayout->addSpacing(15);
|
|
|
m_hBoxLayout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
|
|
|
m_hBoxLayout->addWidget(m_addExpertPushButton, 1, Qt::AlignLeft);
|
|
|
+ m_hBoxLayout->addStretch();
|
|
|
+ m_hBoxLayout->addWidget(m_detailPushButton);
|
|
|
+ m_hBoxLayout->addWidget(m_deletePushButton);
|
|
|
+ setListButtonHidden(true);
|
|
|
|
|
|
m_vBoxLayout->addWidget(m_expertListWidget);
|
|
|
}
|
|
@@ -53,12 +63,53 @@ void ExpertManageView::initLayout()
|
|
|
void ExpertManageView::connectSignalsAndSlots()
|
|
|
{
|
|
|
connect(m_addExpertPushButton, &PushButton::clicked, this, &ExpertManageView::slotAddExpertClicked);
|
|
|
+ connect(m_detailPushButton, &PushButton::clicked, this, &ExpertManageView::slotDetailClicked);
|
|
|
+ connect(m_deletePushButton, &PushButton::clicked, this, &ExpertManageView::slotDeleteClicked);
|
|
|
+ connect(m_expertListWidget, &ExpertListWidget::signalSelectionChanged, this,
|
|
|
+ &ExpertManageView::slotListSelectionChanged);
|
|
|
+ connect(m_expertListWidget, &ExpertListWidget::siganlItemDoubleClicked, this,
|
|
|
+ &ExpertManageView::slotListItemDoubleClicked);
|
|
|
}
|
|
|
|
|
|
-void ExpertManageView::slotAddExpertClicked()
|
|
|
+void ExpertManageView::setListButtonHidden(bool hidden)
|
|
|
+{
|
|
|
+ m_detailPushButton->setHidden(hidden);
|
|
|
+ m_deletePushButton->setHidden(hidden);
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::showExpertInfo()
|
|
|
{
|
|
|
if (m_expertInfoWidget->isVisible() == false) {
|
|
|
m_expertInfoWidget->clearInputs();
|
|
|
m_expertInfoWidget->show();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void ExpertManageView::slotAddExpertClicked()
|
|
|
+{
|
|
|
+ m_expertInfoWidget->setMode(ExpertInfoWidget::Add);
|
|
|
+ showExpertInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::slotDetailClicked()
|
|
|
+{
|
|
|
+ m_expertInfoWidget->setMode(ExpertInfoWidget::Read);
|
|
|
+ showExpertInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::slotDeleteClicked()
|
|
|
+{
|
|
|
+ MessageBox *m = new MessageBox("删除专家信息", "删除后不可恢复,确认删除?", this);
|
|
|
+ m->exec();
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::slotListSelectionChanged()
|
|
|
+{
|
|
|
+ setListButtonHidden(!m_expertListWidget->isItemSelected());
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::slotListItemDoubleClicked()
|
|
|
+{
|
|
|
+ m_expertInfoWidget->setMode(ExpertInfoWidget::Read);
|
|
|
+ showExpertInfo();
|
|
|
+}
|