1. 首页
  2. 移动开发
  3. QT
  4. Qt-Embedded编程实战

Qt-Embedded编程实战

上传者: 2018-12-25 09:43:11上传 RAR文件 1.92MB 热度 42次
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(); }
用户评论
码姐姐匿名网友 2018-12-25 09:43:11

不全,缺了好多,垃圾