qt table中字体倾斜
在itemdelegate,的paint事件中添加
QStyleOptionViewItem newOption(option);
QTransform transform(QTransform::fromTranslate(-option.rect.center().x(),
-option.rect.center().y()));
transform.rotate(90);
painter->setTransform(transform);
transform=transform.inverted();
newOption.rect=transform.mapRect(newOption.rect);
//HtItemModelDeletage::paint(painter, newOption, index);
painter->drawText(newOption.rect,Qt::AlignCenter,celldata);
// restore state of painter
painter->setTransform(transform);