Author Topic: why cannot I drawtext on the widget??  (Read 2859 times)

china_cup

  • Newbie
  • *
  • Posts: 14
    • View Profile
why cannot I drawtext on the widget??
« on: July 22, 2004, 10:02:51 am »
I used the following codes:
QWdiget *widget=new QWidget(this);
QPainter painter(widget);
QRect rect=painter.window();
painter.eraseRect(rect);
QString text="Hello!";
painter.setBackgroundColor(QColor("white"));
painter.setPen(QColor("black"));
painter.drawText(rect,AlignHCenter,text);

but cannot see any word on the widget,I don't know why.

Mickeyl

  • Hero Member
  • *****
  • Posts: 1495
    • View Profile
    • http://www.Vanille.de
why cannot I drawtext on the widget??
« Reply #1 on: July 22, 2004, 10:26:27 am »
You should read more of the fine documents at http://doc.trolltech.com.

Overwrite paintEvent.
Cheers,

Michael 'Mickey' Lauer | Embedded Linux Freelancer | www.Vanille-Media.de
Consider donating, if you like the software I contribute to.