View Full Version : main menu cut-copy-paste interaction with widgets etc.

31st January 2013, 14:45
I've been searching this and other forums for how to do this so I hope I haven't missed something obvious. If you create an edit menu in the main window (http://qt-project.org/doc/qt-4.8/mainwindows-menus.html) (which displays in the menubar in Mac OS X), it takes over events from keyboard commands for copy, paste etc. that are already defined in widgets, line edits etc. and doesn't pass them on.

I found a number of partial solutions but nothing that looks like a nice clean design. But what surprises me is that there isn't a standard recipe or implementation you can just drop in. Standard cut-copy-paste-undo-redo is expected on Mac OS, and to some extent in main window apps on other platforms too.

If I'm missing something, please let me know.

31st January 2013, 17:32
You can just connect the triggered() signals of those menu actions to the respective slots of widgets that support those actions.


1st February 2013, 09:59
Thanks – does that mean I need to do that with every widget? What I was really looking for was a way to do that once (ideally globally, but once for a window would still be better than doing it for every widget).