[PyQt] random QT error

Matt Chambers chambers at imageworks.com
Sat May 12 04:30:12 BST 2007


Strange problem just cropped up, not sure what is going on.  I have a 
QTextEdit box where I'm funneling python logging messages.

     self.__textEdit = QtGui.QTextEdit(self)
     self.__textEdit.setReadOnly(True)
     self.__textEdit.document().setMaximumBlockCount(100)
     self.__textEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap)

    class QtStreamHandler(logging.Handler):
        def __init__(self,parent):
            logging.Handler.__init__(self)
            self.__textWidget = parent
            self.__formater = logging.Formatter("%(levelname)-10s 
%(message)s")
           
        def createLock(self):
            self.__mutex = QtCore.QMutex()
       
        def acquire(self):
            self.__mutex.lock()
       
        def release(self):
            self.__mutex.unlock()
           
        def emit(self,record):
            self.__textWidget.append(self.__formater.format(record))
            self.__textWidget.ensureCursorVisible()


This line is causing the error.
self.__textWidget.append(self.__formater.format(record))

It doesn't matter what I put in, I tried a string literal, got same error.
self.__textWidget.append("bob")

Error:

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registed using qRegisterMetaType().)

It only happens once.  From what I can see its not dropping any messages 
either..  Google turns up nothing, just some speculation on a threading 
problem.

-Matt




More information about the PyQt mailing list