paintEvent函数被疯狂的调用
class Ticker: public QWidget
{
public:
Ticker(QWidget * = 0);
void setText(const QString &);
QSize sizeHint() const;
protected:
void paintEvent(QPaintEvent *);
private:
QString myText;
};
void Ticker::paintEvent(QPaintEvent *)//为什么运行的时候这个函数会被疯狂的调用....
{
QPainter painter(this);
painter.drawText(0, 10, myText);
}
[解决办法]