[PyQt] qlistview and finditem

Scott Frankel frankel at circlesfx.com
Tue Dec 2 06:59:38 GMT 2008


On Dec 1, 2008, at 10:51 PM, Milan Hemžal wrote:

> hi,
>
> i'm learning PyQt and cannot find how create:
>
> a=["1Test1","2Test1","3Test1","4Test1","5Test1"]
>
>
> def __init__(self):
>        QtGui.QDialog.__init__(self)
>
>        app.connect(self.lv_find,QtCore.SIGNAL("textEdited ( const  
> QString &
> )"),self.zmena_sl)
>
>
> def fill_lv(self,ss):
>        #empty lv
>        self.lv_seznam.clear()
> 	#fille new content
>        for id,name, in enumerate(a):
>            item=QtGui.QListWidgetItem(name)
>            item.setData (QtCore.Qt.UserRole, QtCore.QVariant(id))
>            self.lv_seznam.insertItem(0,item)
>
>    def zmena_sl(self,c):
> -->        self.lv_seznam.findItems(c,QtCore.QtCore.MatchFlags("="))  
> <--
>
> i cannot find, howto create Qt.MatchFlags

I believe you need to specify which match flag you'd like to use.   
This works for me:

	self.theList.findItems(data, QtCore.Qt.MatchExactly)




Scott


>
>
> Traceback (most recent call last):
>  File "/home/milan/workspace/seneka/src/dlg/dlg_divadlo.py", line  
> 67, in
> zmena_sl
>    self.lv_seznam.findItems(c,QtCore.MatchFlags("="))
> AttributeError: 'module' object has no attribute 'MatchFlags'
>
>
>
>
> -- 
> Milan Hemžal
> 3 Trees s.r.o.
> --------------------------
> Dřevěné podlahy a koupelny
>
> Kontakt info:
> GSM +420 775 393 335
> www: www.3trees.cz
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>












More information about the PyQt mailing list