[PyQt] qvariant_cast?

Phil Thompson phil at riverbankcomputing.com
Fri Jun 27 16:43:35 BST 2008

On Fri, 27 Jun 2008 09:37:10 -0600, Carlos Scheidegger
<cscheid at sci.utah.edu> wrote:
> Hi,
> 	I have a QVariant that contains a QBrush, and I'd like to get it from  
> PyQt. The Qt documentation mentions qvariant_cast for that purpose,  
> but I see no PyQt methods that achieve a similar functionality (I see,  
> however, toDouble and friends). I'm trying to get the background brush  
> from index.data(QtCore.Qt.BackgroundRole) in a custom  
> QItemDelegate.paint(). Maybe there's a simpler way?

brush = QBrush(qvariant)


More information about the PyQt mailing list