Humm, so far I managed to do:
Qt Code:
randomize->setText("Randomize"); connect(randomize, SIGNAL(triggered()), this, SLOT(test())); ui->spinBox->addAction(randomize);To copy to clipboard, switch view to plain text mode
and changed in desinger, spinBox contextMenuPolicy to actionsContextMenu.
This works fine but I want to keep the default options (Undo, redo, copy, paste etc.) and only append mine option at the end.
I checked what you gave me there Lykurg, but cannot figure out much of this.
Should be CustomContextMenu! Use the emited customContextMenuRequested signal and connect it to your own slot. There you fetch the widgets actions via QWidget:actions() create a menu out of them, add your own actions and and execute it.actionsContextMenu
OR
set to actionsContextMenu, use the way you mentioned by adding the custom functions to the widget and it should work
EDIT: If you want the same look and feel use createStandardContextMenu() and alter the retrieved QMenu with your own actions.
Sorry for the confusing answers, but you will find all necessary informations...
Last edited by Lykurg; 11th June 2009 at 21:13.
maybe this can help you.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Bookmarks