本人刚学习Qt没多久,刚在学习用Qt绘图,就碰到问题,不知道如何解决,请帮忙,谢谢!
下面是代码:
#include<qapplication.h>
#include<qpainter.h>
#include<qbrush.h>
int main(int argc, char *argv[ ])
{
QApplication app(argc, argv);
QPainter p(this);
p.setPen(QPen(Qt::black,2,Qt::SolidLine));
p.setBrush(QBrush(Qt::red,Qt::SolidPattern));
p.drawEllipse(20,20,100,80);
return app.exec();
}
错误提示:invalid use of 'this' in non-member function