[PyQt] item delegates
Mads Ipsen
mpi at comxnet.dk
Thu Feb 5 11:46:44 GMT 2009
--------- Original Besked --------
Fra: Baba-k <babakage at gmail.com>
Til: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
Emne: Re: [PyQt] item delegates
Dato: 05/02/09 11:09
>
> Hi Mads,
>
> I dunno if this is the best way of doing it but could you test to see
which
> row/column the item is inside the delegate and if its not in the correct
one
> then call the parent class method for creating the editor widget otherwise
> use yours, for example..
>
> class myDelegate(QtGui.QItemDelegate):
> ....
> def createWidget(self, index ...):
> if index.column() != someColumn and index.row() != someRow:
> return QtGui.QItemDelegate(self, index, ... )
>
> return myWidget
>
> if that makes sense, could be over kill though. Alternatively if you are
> using a custom model you might be able to set some flags on the cell you
> want and not the others.
>
> hope that helps
> babak
>
>
> Mads Ipsen-3 wrote:
> >
> > Hi,
> >
> > Suppose I have a TableView. Then I can set itemdelegates for a
column, a
> > row
> > or the entire view using the respective methods
> >
> > void setItemDelegateForColumn ( int column, QAbstractItemDelegate *
> > delegate
> > )
> > void setItemDelegateForRow ( int row, QAbstractItemDelegate *
delegate )
> > void setItemDelegate ( QAbstractItemDelegate * delegate )
> >
> > All this is fine. But how do I specify a delegate for a single cell
in the
> > table?
> >
> > Mads
> > _______________________________________________
> > PyQt mailing list PyQt at riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/item-delegates-tp21846648p21848453.html
> Sent from the PyQt mailing list archive at Nabble.com.
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
That actually how I do it. But, as you point out, its somewhat overkill.
Mads
More information about the PyQt
mailing list