Hello, I am using the PyQT4 designer to create the MainWindow with very simple drop-down menu items. File->Exit, Edit->Cut,Copy,Paste After converting .ui to .py I am trying to make some manual modifications to the Python script to set the SLOTs for cut/copy/paste actions.
Within the main window, I have a tabbed-Gui, where clicking on each tab will display more options for the users to choose various files and directories. I am using lineEdit and TextEdit widgets for this and would like to have the cut/copy/paste menus from the MainWindow let the user use them while typing text into the lineEdit and textEdit spaces. I am setting the slots as below: self.actionExit.triggered.connect(self.exitMenu) self.actionCopy.triggered.connect(self.copyMenu) self.actionCut.triggered.connect(self.cutMenu) self.actionPaste.triggered.connect(self.pasteMenu) I am implementing routines for the "slot" functions, where I need help. Exit action works. But I couldn't find a way to implement the rest for this situation where there are multiple locations on the Gui where these actions are to be done. def exitMenu(self): QtCore.QCoreApplication.instance().quit() def cutMenu(self): print("cutting text ") ??? def copyMenu(self): print("Copying text ") ??? def pasteMenu(self): print("Pasting text ") ??? If I was using just one editor for all these actions, I could do something like: edit = QtGui <http://qt-project.org/doc/QtGui.html>.QTextEdit<http://qt-project.org/doc/QTextEdit.html> (self) pasteAction.triggered.connect(edit.paste) cutAction.triggered.connect(edit.cut) etc. But here I have multiple places on multiple tabs of the Gui to do cut/copy/paste actions. Is there a way in PyQt4 that I can do it? Thanks! SM
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor