#include "IndexSystemWidget.h" #include #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) { RoundMenu *menu = new RoundMenu(); if (m_mindView->root() == nullptr) { QAction *act3 = new QAction("创建根节点"); menu->addAction(act3); connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode); } else { QAction *act2 = new QAction("清空"); menu->addAction(act2); connect(act2, &QAction::triggered, this, &IndexSystemWidget::slotClearAllNodes); } menu->exec(event->globalPos() + QPoint(-40, -20)); QWidget::contextMenuEvent(event); } void IndexSystemWidget::slotSelectAllNodes() { qDebug() << __FUNCTION__ << __LINE__ << endl; } void IndexSystemWidget::slotClearAllNodes() { m_mindView->clear(); } void IndexSystemWidget::slotCreateRootNode() { CNodeData n = CNodeData(m_proj->id, m_type, 0); n.name = m_proj->projectName; m_mindView->addNode(n); }