Я наследовался от QHeaderView и paintSection переопределял.
void RotatedHeader::paintSection( QPainter * painter, const QRect & rect, int logicalIndex ) const
{
if(_model)
{
QVariant data = _model->headerData(logicalIndex, orientation(), Qt::UserRole);
if (data.isValid())
{
QString text=data.toString();
QPixmap original_button(rect.width(), rect.height());
QPainter original_button_painter(&original_button);
QHeaderView::paintSection(&original_button_painter, QRect(0, 0, rect.width(), rect.height()), logicalIndex);
QPixmap pix(rect.width(), rect.height());
QPainter p(&pix);
p.drawPixmap(0, 0, original_button);
QRect new_r(0, 0, rect.height(), rect.width());
QMatrix m;
m.translate(0, rect.height());
m.rotate(-90);
p.setWorldMatrix(m, true);
p.drawText(new_r, Qt::AlignCenter, text);
painter->drawPixmap(rect, pix);
}
}