[PyQt] item delegates

Baba-k babakage at gmail.com
Thu Feb 5 10:02:58 GMT 2009

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

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.

More information about the PyQt mailing list