void CGI_SCADA_DLL_TreeItemNET::GetPopUpMenu() { QMenu *SwitchMenu = new QMenu(); QAction *pAddLink = new QAction(tr("新建连接"), SwitchMenu); connect(pAddLink, SIGNAL(triggered()), this, SLOT(slot_AddLink())); QAction *pDeleteChannel = new QAction(tr("删除通道"), SwitchMenu); connect(pDeleteChannel, SIGNAL(triggered()), this, SLOT(slot_DeleteChannel())); QAction *pSetEnable = new QAction(tr("使能通道"), SwitchMenu); pSetEnable->setCheckable(true); if (this->isDisabled()) { pSetEnable->setChecked(false); }else { pSetEnable->setChecked(true); } // this->isDisabled(); connect(pSetEnable, SIGNAL(triggered(bool)), this, SLOT(slot_SetEnable(bool))); SwitchMenu->addAction(pAddLink); SwitchMenu->addAction(pDeleteChannel); SwitchMenu->addAction(pSetEnable); SwitchMenu->addSeparator(); SwitchMenu->exec(QCursor::pos()); // delete SwitchMenu;//防止内存泄露 SwitchMenu->deleteLater(); qDebug()<<__func__<<__LINE__<<__FILE__<<this->childCount(); return ; }
void CGI_SCADA_DLL_TreeItemCOM::GetPopUpMenu() { QMenu *SwitchMenu = new QMenu(); //->添加网络节点 // AddColChannel->setIcon(QIcon(":/ico/networkc.ico")); QAction *pAddDevice = new QAction(tr("新建设备"), SwitchMenu); connect(pAddDevice, SIGNAL(triggered()), this, SLOT(slot_AddDevice())); QAction *pDeleteChannel = new QAction(tr("删除通道"), SwitchMenu); connect(pDeleteChannel, SIGNAL(triggered()), this, SLOT(slot_DeleteChannel())); QAction *pSetEnable = new QAction(tr("使能通道"), SwitchMenu); pSetEnable->setCheckable(true); if (this->isDisabled()) { pSetEnable->setChecked(false); }else { pSetEnable->setChecked(true); } // this->isDisabled(); connect(pSetEnable, SIGNAL(triggered(bool)), this, SLOT(slot_SetEnable(bool))); // QAction *pAddNET = new QAction(tr("添加NET"),SwitchMenu); // connect(pAddNET,SIGNAL(triggered()),this,SLOT(slot_AddNET())); SwitchMenu->addAction(pAddDevice); SwitchMenu->addAction(pDeleteChannel); SwitchMenu->addAction(pSetEnable); // SwitchMenu->addAction(pAddNET); SwitchMenu->addSeparator(); //-> 运行菜单 SwitchMenu->exec(QCursor::pos()); // delete SwitchMenu;//防止内存泄露 SwitchMenu->deleteLater(); qDebug()<<__func__<<__LINE__<<__FILE__<<this->childCount(); return ; }