Qt-interest Archive, November 2007
Rotate Text in QTableWidget
Message 1 in thread
Hallo, i'm programming with Qt 4.2.3, and now i'd like to create a
tablewidget and rotate the text of the cells in 90 degrees to make the
contents of the cell shown in vertical. I've read the documentations of
Qt, and i think maybe i need to derive a subclass from QItemDelegate,
and re-write the protected function draw Display, and rotate the painter
in 90. But nothing happens, when i set this new item to the
QTableWidget. The cell display nothing. Is there any other things that i
should to pay attention? Thanks.
The Code of drawDisplay in QItemDelegate:
void CEMEffectItemDelegate::drawDisplay(QPainter *painter, const
QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
{
painter->save();
painter->rotate(-90);
QItemDelegate::drawDisplay(painter, option, rect, text);
painter->restore();
}
Is this correct? But i got nothing displayed in the cells..pls help me.
Ning
--
[ signature omitted ]