[SOLVED] Problem in writing text on QTableWidget using Qpainter.
-
I want to draw a text on QtableWidget Item after filling the item backGround as blue..
@
void DetailedViewImage::paint(QPainter *painter, const QRect &rect,
const QPalette &palette, EditMode mode) const
{
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);int yOffset = (rect.height() - PaintingScaleFactor) / 2; painter->translate(rect.x(), rect.y() + yOffset); int x1=40,x2=80; for (int i = 0; i < myMaxImageCount; ++i) { if (i < myImageCount) { // painter->drawPolygon(starPolygon, Qt::WindingFill); painter->drawText( QPoint(x1,0.0), "HELLO"); painter->fillRect(QRect(QPoint(1.0,0.0),QSize(80,20)),Qt::blue); } } painter->restore();
}
@
Here i am able to see the Text "Hello" on TableWidget , but not on the blue color background...both of them are appearing in different position.