Qt-Embedded编程实战

时间:2013-10-10 04:38:50
【文件属性】:

文件名称:Qt-Embedded编程实战

文件大小:1.92MB

文件格式:RAR

更新时间:2013-10-10 04:38:50

Q Embedded 编程实战

Qt 学习,实验,源码 #include #include #include #include class DrawDemo:public QWidget { public: DrawDemo( QWidget *parent=0, const char *name=0 ); void paintEvent( QPaintEvent *); private: void drawPrimitives( QPainter *p); }; DrawDemo::DrawDemo( QWidget *parent, const char *name):QWidget(parent, name) { setBackgroundColor(white); } void DrawDemo::drawPrimitives(QPainter *p) { QBrush b1( Qt::blue ); QBrush b2( Qt::green, Qt::Dense6Pattern ); QBrush b3( Qt::NoBrush ); QBrush b4( Qt::CrossPattern ); p->setPen( Qt::red ); p->setBrush( b1 ); p->drawRect( 20, 20, 120, 90 ); p->setBrush( b2 ); p->drawRoundRect( 180, 20, 120, 90, 20, 20 ); p->setBrush( b3 ); p->drawEllipse( 20, 140, 120, 60 ); p->setBrush( b4 ); p->drawPie( 180, 140, 120, 120, 45*16, 90*16 ); p->setBrush( b1 ); p->drawLine( 20, 220, 300, 220 ); } void DrawDemo::paintEvent( QPaintEvent *) { QPainter paint(this); drawPrimitives(&paint); } int main(int argc, char **argv) { QApplication app(argc, argv); DrawDemo drawdemo; drawdemo.resize( 320, 240 ); drawdemo.setCaption( "QT DRAW DEMO"); app.setMainWidget(&drawdemo); drawdemo.show(); return app.exec(); }


网友评论

  • 不全,缺了好多,垃圾