练习QPainter,运行时看不到图形,只有一个灰色窗口
#include<QApplication>#include<QPaintDevice>#include<QPainter>#include<QPixmap>#include<QWidget>#include<QtGui>#include<QWidget>int main(int argc,char *argv[]){ QApplication app(argc,argv); //QWidget *wid=new QWidget(); //QPixmap *pm=new QPixmap(200,100); QWidget *pm=new QWidget(); QPainter painter(pm); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(QPen(Qt::black,12,Qt::DashDotLine,Qt::RoundCap)); painter.setBrush(Qt::green); painter.drawEllipse(80,80,400,240); pm->show(); return app.exec();}