{
if (element
== QStyle::CE_HeaderLabel) { if (!hv || hv->orientation() != Qt::Horizontal)
return QProxyStyle::drawControl(element, option, painter, widget);
painter->save();
// painter->translate(header->rect.topLeft());
painter->translate(header->rect.bottomLeft());
painter->rotate(-45);
painter->drawText(0,0,header->text);
painter->restore();
return;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
};
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter,
const QWidget *widget = 0) const
{
if (element == QStyle::CE_HeaderLabel) {
const QHeaderView *hv = qobject_cast<const QHeaderView *>(widget);
if (!hv || hv->orientation() != Qt::Horizontal)
return QProxyStyle::drawControl(element, option, painter, widget);
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option);
painter->save();
// painter->translate(header->rect.topLeft());
painter->translate(header->rect.bottomLeft());
painter->rotate(-45);
painter->drawText(0,0,header->text);
painter->restore();
return;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks