[Qt-interest] Coloring a header
Andre Somers
andre at familiesomers.nl
Tue Mar 23 14:51:22 CET 2010
SALOMEHER at terra.es wrote:
> Hi,
>
> I have a QAbstractTableModel and I have reimplemented some of its
> functions including:
> data (const QModelIndex & index, int role) and headerData (int
> section, Qt:: Orientation orientation, int role)
> But I can not color the background of a header, ie data () if I can
> use role == Qt:: BackgroundRole and assign a color, but this role does
> not work headerData.
>
> Is it possible to color a header?
If background role is ignored, that would be a bug IMHO. According to
the documentation of QHeaderView, this role should be respected.
However, if needed, you can follow the tip in there that you can
subclass QHeaderView and reimplement paintEvent() if you need custom
painting.
André
More information about the Qt-interest-old
mailing list