void ChatWidget::contextMenu(QPoint point) { std::cerr << "In context menu" << std::endl; QMenu *contextMnu = ui->chatTextEdit->createStandardContextMenu(point); contextMnu->addSeparator(); QAction *action = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); action->setDisabled(RSLinkClipboard::empty()); contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink())); contextMnu->exec(QCursor::pos()); delete(contextMnu); }
void MimeTextEdit::contextMenuEvent(QContextMenuEvent *e) { emit calculateContextMenuActions(); QMenu *contextMenu = createStandardContextMenu(e->pos()); /* Add actions for pasting links */ contextMenu->addSeparator(); QAction *pasteLinkAction = contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink())); if (RSLinkClipboard::empty()) { pasteLinkAction->setDisabled(true); } QList<QAction*>::iterator it; for (it = mContextMenuActions.begin(); it != mContextMenuActions.end(); ++it) { contextMenu->addAction(*it); } contextMenu->exec(QCursor::pos()); delete(contextMenu); }
/** context menu searchTablewidget2 **/ void CreateForumMsg::forumMessageCostumPopupMenu(QPoint point) { QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point); contextMnu->addSeparator(); QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull())); contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste own certificate link"), this, SLOT(pasteOwnCertificateLink())); if (RSLinkClipboard::empty()) { pasteLinkAct->setDisabled (true); pasteLinkFullAct->setDisabled (true); } contextMnu->exec(QCursor::pos()); delete(contextMnu); }