⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paint.cpp

📁 一个简单的在LINUX QT下面画曲线图的程序
💻 CPP
字号:
/****************************************************************************** Form implementation generated from reading ui file 'paint_ui.ui'**** Created: Sun Jan 13 13:31:15 2008**      by:  The User Interface Compiler (uic)**** WARNING! All changes made in this file will be lost!****************************************************************************/#include "paint_ui.h"#include "paint.h"#include <qpainter.h>#include <qlabel.h>#include <qpushbutton.h>#include <qlayout.h>#include <qvariant.h>#include <qtooltip.h>#include <qwhatsthis.h>#include <qtextcodec.h>/*  *  Constructs a paint_ui which is a child of 'parent', with the  *  name 'name' and widget flags set to 'f'  */paint::paint( QWidget* parent,  const char* name, WFlags fl ){	QFont unifont=QFont("XINGKAI",50,500);//	setFont(unifont);	unifont.setPixelSize(40);	QTextCodec* codec=QTextCodec::codecForName("GBK");		pBtn_paint->setFont(unifont);	pBtn_paint->setText(codec->toUnicode("画图"));	connect(pBtn_paint,SIGNAL(clicked()),this,SLOT(paintEvent()));}/*   *  Destroys the object and frees any allocated resources */paint::~paint(){    // no need to delete child widgets, Qt does it all for us}void paint::paintEvent(){	QPainter  paint(Label_paint);	paint.setPen(QPen(black,2,SolidLine,RoundCap,RoundJoin));	paint.translate(10.0,20.0);	QPointArray points(10);	points[0]=QPoint(20,40);	points[1]=QPoint(25,45);	points[2]=QPoint(35,50);	points[3]=QPoint(40,50);	points[4]=QPoint(50,60);	points[5]=QPoint(60,65);	points[6]=QPoint(70,78);	points[7]=QPoint(80,56);	points[8]=QPoint(90,52);	points[9]=QPoint(100,68);	paint.drawPolyline(points);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -