Hi,
I have a problem with context menu.....
I have a context menu of copy past action handler on QTableWidget.
copyAct->setShortcut(tr("Ctrl+C"));
QAction* copyAct = new QAction("&Copy", qTableWidgetObj);
copyAct->setShortcut(tr("Ctrl+C"));
To copy to clipboard, switch view to plain text mode
and for paste:
QAction* pasteAct = new QAction("&Paste", qTableWidgetObj);
pasteAct->setShortcut(QKeySequence::Paste);
To copy to clipboard, switch view to plain text mode
I connect this with a slot as
connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));
connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));
To copy to clipboard, switch view to plain text mode
I create context menu with
qTableWidgetObj->setContextMenuPolicy(Qt::ActionsContextMenu);
qTableWidgetObj->setContextMenuPolicy(Qt::ActionsContextMenu);
To copy to clipboard, switch view to plain text mode
Contextmenu gets creates and works fine if I press on one of the options of context menu.
But when I press shortcut key on the table widget no slot is called.
Please let me know your suggestions as how to implement it?
Bookmarks