[Qt-interest] Checkbox in the header of a model?
Clinton Stimpson
clinton at elemtech.com
Mon Apr 20 21:02:58 CEST 2009
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
More information about the Qt-interest-old
mailing list