比尔盖子
比尔盖子

Reputation: 3657

Reimplemented copy() slot in PyQt for QTextBrowser Never been Called

I'm going to replace some content in QTextBroswer before they pushed to clipboard. So I should reimplement copy(). But, PyQt doesn't call my overloaded method. What's wrong?

from PyQt4 import QtCore, QtGui

class Label(QtGui.QTextBrowser):

    @QtCore.pyqtSlot()
    def copy(self):
        # Never been called.
        print("Called")

Upvotes: 0

Views: 87

Answers (1)

qurban
qurban

Reputation: 3945

QTextBrowser.copy() is a slot not a virtual function, so you have to be careful to reimplement it. Please have a look at this post, this may help you.

Upvotes: 3

Related Questions