[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QComboBox.findItem and tuples
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2012-10-11 21:26:36
Message-ID: 7ee834d654a595a8ef8f84228d5595bb () localhost
[Download RAW message or body]

On Thu, 11 Oct 2012 22:21:09 +0200, Vicent Mas <uvemas@gmail.com> wrote:
> Hi,
> 
> as shows the following code, QComboBox.findItem works fine with lists
> but no with tuples.
> 
> if __name__ == "__main__":
>     import sip
>     sip.setapi('QVariant', 2)
>     from PyQt4 import QtGui
>     a = QtGui.QApplication([])
>     cb = QtGui.QComboBox()
>     cb.addItem("Foo", [3,4])
>     cb.addItem("Bah", (2, 2))
>     print cb.findData([3,4])
>     print cb.findData((2,2))
> 
> Is it a bug or just a limitation of the implementation? Or something
else?
> 
> TIA

It's a limitation of QVariant in that it doesn't provide an opportunity to
inject a call to a Python comparison function when comparing custom types.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic