PDA

View Full Version : PyQt4. QTextEdit. How I can overload copy()?



lizzard
6th May 2009, 07:30
Hi all.

Can anybody help with next problem. I trying to overload "copy()" method of QTextEdit, but it doesn't work.

class MyQTextEdit(QtGui.QTextEdit):
def __init__(self, *args):
QtGui.QTextEdit.__init__(self, *args)

def copy(self):
QtGui.QTextEdit.copy(self)
print "copy"


But after execution when I copy text from my QTextEdit console still empty. Why?

spirit
6th May 2009, 07:37
because this slot is not virtual.

lizzard
6th May 2009, 07:50
Hmm... if I want do any additional actions when users copy text from qtextedit, how I can release this?

spirit
6th May 2009, 07:54
I don't know what do you want to achive, but take a look at this signal QTextEdit::copyAvailable.

lizzard
6th May 2009, 08:08
This is not exactly solution... but thanks, will think about it.