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

Andreas Pakulat apaku at gmx.de
Mon Apr 20 20:52:28 CEST 2009


On 20.04.09 11:42:23, 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?

No, the reason is that flags() are not used for header data items, so
the headerview doesn't know that its items are checkable.
 
> 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.

Quite frankly I can't think of any application right now that I've ever
used that had checkboxes in the header. So personally I'm not surprised
that Qt Model/View doesn't support this out of the box.

Andreas

-- 
Good news.  Ten weeks from Friday will be a pretty good day.



More information about the Qt-interest-old mailing list