|
@@ -30,21 +30,16 @@ void IndexSystemWidget::initLayout()
|
|
|
|
|
|
void IndexSystemWidget::contextMenuEvent(QContextMenuEvent *event)
|
|
|
{
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << endl;
|
|
|
-
|
|
|
QMenu *menu = new QMenu();
|
|
|
|
|
|
if (m_mindView->root() == nullptr) {
|
|
|
QAction *act3 = menu->addAction("创建根节点");
|
|
|
connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode);
|
|
|
+ } else {
|
|
|
+ QAction *act2 = menu->addAction("清空");
|
|
|
+ connect(act2, &QAction::triggered, this, &IndexSystemWidget::slotClearAllNodes);
|
|
|
}
|
|
|
|
|
|
- QAction *act1 = menu->addAction("全选");
|
|
|
- connect(act1, &QAction::triggered, this, &IndexSystemWidget::slotSelectAllNodes);
|
|
|
-
|
|
|
- QAction *act2 = menu->addAction("清空");
|
|
|
- connect(act2, &QAction::triggered, this, &IndexSystemWidget::slotClearAllNodes);
|
|
|
-
|
|
|
menu->exec(event->globalPos());
|
|
|
|
|
|
QWidget::contextMenuEvent(event);
|
|
@@ -57,13 +52,11 @@ void IndexSystemWidget::slotSelectAllNodes()
|
|
|
|
|
|
void IndexSystemWidget::slotClearAllNodes()
|
|
|
{
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << endl;
|
|
|
+ m_mindView->clear();
|
|
|
}
|
|
|
|
|
|
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);
|