C++ (Qt)#include <QtGui> class Widget : public QWidget{ public: Widget(QWidget* parent = 0) : QWidget(parent) { k = 0; } QPainter Painter; int k; void paintEvent(QPaintEvent* event) { Painter.begin(this); for (int i = 0; i < 30; i++) { k++; Painter.drawText(0, i*24, 200, 24, Qt::AlignVCenter, QString::number(k)+"Text Text"+QString::number(k)+ "Text Text Text Text "); } Painter.end(); } void timerEvent(QTimerEvent* event) { repaint(); } void keyPressEvent(QKeyEvent* event) { repaint(); } }; int main(int argc, char *argv[]){ QApplication a(argc, argv); Widget w; w.show(); //w.startTimer(50); return a.exec();}
void QPainter::drawText ( const QPoint & position, const QString & text )