[PyQt] PyQt 5: Equality operator not implemented for QStringListModel?

Phil Thompson phil at riverbankcomputing.com
Wed Jun 25 16:29:28 BST 2014


On 25/06/2014 3:57 pm, Arve Knudsen wrote:
> Hi guys
> 
> Using PyQt 5.2.1, I've noticed that comparing two QStringListModels
> for equality always returns false, is there any reason for this?
> Example:
> 
>     from PyQt5 import QtCore
> 
>     model1 = QtCore.QStringListModel(['1', '2'])
>     model2 = QtCore.QStringListModel(['1', '2'])
> 
>     print(model1 == model2) # Prints False
>     # Corresponding QStringLists can be compared OTOH
>     print(model1.stringList() == model2.stringList()) # Prints True

It's not supported by Qt.

Phil


More information about the PyQt mailing list