I did that now:
void HeaderViewHorizontal
::paintSection(QPainter* painter,
const QRect& rect,
int logicalIndex) const
{
painter->save();
matrix.rotate(45);
painter->setWorldMatrix(matrix);
painter->restore();
}
void HeaderViewHorizontal::paintSection(QPainter* painter,
const QRect& rect,
int logicalIndex) const
{
QMatrix matrix;
painter->save();
matrix.rotate(45);
painter->setWorldMatrix(matrix);
painter->restore();
}
To copy to clipboard, switch view to plain text mode
but now the header's texts are not shown at all.
Added after 7 minutes:
I've forgotten to call drawText(), here is upgrade:
void HeaderHorizontal
::paintSection(QPainter* painter,
const QRect& rect,
int logicalIndex) const
{
// painter->save();
matrix.rotate(45);
painter->setWorldMatrix(matrix);
painter->drawText(this->rect(),
this->model()->headerData(logicalIndex,
Qt::Horizontal).toString());
// painter->restore();
}
void HeaderHorizontal::paintSection(QPainter* painter,
const QRect& rect,
int logicalIndex) const
{
QMatrix matrix;
// painter->save();
matrix.rotate(45);
painter->setWorldMatrix(matrix);
painter->drawText(this->rect(),
this->model()->headerData(logicalIndex,
Qt::Horizontal).toString());
// painter->restore();
}
To copy to clipboard, switch view to plain text mode
but now I get all titles at first section. Screenshot attached.horizHeaderTextAtFirstSection.jpg
Bookmarks