12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #include "IndexSystemWidget.h"
- #include <dbService/ClassSet.h>
- #include <CCanvas/CMindView.h>
- #include <CMind.h>
- #include <QLayout>
- #include <QMenu>
- #include <QContextMenuEvent>
- #include <QDebug>
- 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->root() == nullptr) {
- 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);
- }
|