我正在创建一个 QSystemTrayIcon 托盘菜单。它的上下文菜单有几个我需要识别的操作。
public slots:
void s_showNote();
void Traymenu::createMainContextMenu(){
...
std::string noteTitle = m_noteList[i]->getTitle();
QString menuEntryName = QString::fromStdString(noteTitle);
QAction *openNote = m_mainContextMenu.addAction(menuEntryName);
QObject::connect(openNote,SIGNAL(triggered() ),this,SLOT(s_showNote()) );
QVariant noteID;
noteID.setValue(m_noteList[i]->getID());
openNote->setData(noteID);
错误是
QObject::connect: No such slot QSystemTrayIcon::s_showNote()
上面的所有代码都是我的类定义的一部分,它继承自QSystemTrayIcon
. 如何调用 SLOT?