pyqt  

Re: [PyQt] How to use QHash in PyQt?

Phil Thompson
Wed, 03 Feb 2010 01:41:28 -0800

On Wed, 3 Feb 2010 10:31:44 +0800 (CST), donglongchao
<donglongc...@163.com>
wrote:
> Hi,all
> 
> I am newbie to PyQt and I have a question when I work on my app with
PyQt.
> I want to use a QDataStream to form a QHash object into a QByteArray and
> write it into a QTcpSocket.But there is an error when I run my app said 
> NameError: global name 'QHash' is not defined.I have import everything
from
> QtCore and QtGui.Also I can locate qhash.sip in my computer
> (/usr/share/sip/PyQt4/QtCore/qhash.sip).So I want to know wherer is the
> problem and how to use QHash here.

In C++ QHash is a template. For the classes that Qt provides a qHash()
implementation, PyQt implements the __hash__ method so that hash() returns
the value that qHash() returns.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt