#include "IndexSystemWidget.h" #include #include #include #include #include #include #include IndexSystemWidget::IndexSystemWidget(ProjectInfo *proj, int type, QWidget *parent) : EvalWidget(proj, type, parent) { setTitle("指标体系设计"); initWidgets(); initLayout(); } void IndexSystemWidget::initWidgets() { m_mindView = new CMindView(this); } void IndexSystemWidget::initLayout() { m_contentLayout->addWidget(m_mindView); } void IndexSystemWidget::contextMenuEvent(QContextMenuEvent *event) { qDebug() << __FUNCTION__ << __LINE__ << endl; QMenu *menu = new QMenu(); QAction *act1 = menu->addAction("全选"); connect(act1, &QAction::triggered, this, &IndexSystemWidget::slotSelectAllNodes); QAction *act2 = menu->addAction("清空"); connect(act2, &QAction::triggered, this, &IndexSystemWidget::slotClearAllNodes); if (m_mindView->mind() != nullptr && m_mindView->mind()->nodeList().count() <= 0) { QAction *act3 = menu->addAction("创建根节点"); connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode); } menu->exec(event->globalPos()); QWidget::contextMenuEvent(event); } void IndexSystemWidget::slotSelectAllNodes() { qDebug() << __FUNCTION__ << __LINE__ << endl; } void IndexSystemWidget::slotClearAllNodes() { qDebug() << __FUNCTION__ << __LINE__ << endl; } void IndexSystemWidget::slotCreateRootNode() { qDebug() << __FUNCTION__ << __LINE__ << endl; CNodeData n = CNodeData(m_proj->id, m_type, 0); n.name = m_proj->projectName; m_mindView->addNode(n); }