//GraphView.h//Объявление переменныхclass GraphView : public QWidget{ Q_OBJECT QAction* m_RemarkAction; QMenu tailContextMenu; ...} //GraphView.cpp//Обработчик щелчка по пункту менюvoid GraphView::setRemark(){ m_beep->play(); QMessageBox::information(this, "REMARK", "REMARK CONNECT!");} //добавление пункта меню и установка соединения//GraphView.cppGraphView::GraphView(){ m_RemarkAction = tailContextMenu.addAction("Add/Edit Remark"); if(connect(m_RemarkAction, SIGNAL(triggered()), this, SLOT(setRemark()))) {QMessageBox::information(this, "REMARK", "CONN OK!");} else {QMessageBox::information(this, "REMARK", "CONN BAD!");}; ...} //Показ меню в//GraphView.cppvoid GraphView::paintEvent(QPaintEvent *event){if (QApplication::mouseButtons()==Qt::RightButton) {tailContextMenu.exec(QCursor::pos());} ...}
triggered (bool)
triggered ()
connect(m_RemarkAction, SIGNAL(triggered(QAction *)), this, SLOT(setRemark(QAction *)))
C++ (Qt)connect(m_RemarkAction, SIGNAL(triggered(bool)), this, SLOT(setRemark()))
connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(Qbject*)));connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed()));connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()));
connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed(QObject*)));
//Показ меню в//GraphView.cppvoid GraphView::paintEvent(QPaintEvent *event){if (QApplication::mouseButtons()==Qt::RightButton) {tailContextMenu.exec(QCursor::pos());} ...}