[Qt-interest] Checkbox in the header of a model?

Dario Ahdoot dario.ahdoot at image-metrics.com
Mon Apr 20 21:13:27 CEST 2009


That is what I was afraid of. However, that will require having a pixmap to match the native look for each system, blah blah blah. Not fun.

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Clinton Stimpson
Sent: Monday, April 20, 2009 12:03 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Checkbox in the header of a model?

Dario Ahdoot wrote:
>
> I am trying to put a tri-state check box in the header of one of the 
> columns of my QAbstractItemModel classes, but am finding that it 
> doesn't seem to be possible. I am overriding 
> QAbstractItemModel::headerData and checking for Qt::CheckStateRole but 
> that role never seems to get passed in. Is there any way to achieve this?
>
> Searching Qt docs and google in general seems to have no mention of 
> this. I imagine this feature is so common that Qt would support it out 
> of the box, but I guess I'm wrong.
>
You can do it by setting a pixmap of the chechbox in with the 
DecorationRole.
You'll have to control the pixmap yourself, with maybe the help of 
QStyle for a native look.

Clint


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list