QCustomPlot使用手册(一)

介绍 

QCustomPlot 是一个基于Qt的画图和数据可视化C++控件。QCustomPlot 致力于提供美观的界面,高质量的2D画图、图画和图表,同时为实时数据可视化应用提供良好的解决方案。 

类相关

QCustomPlot使用手册(一)_第1张图片

继承

QCustomPlot使用手册(一)_第2张图片

获取

下载地址:http://qcustomplot.com/index.php/download,QCustomPlot.tar.gz,目前更新到1.3.1版本。

官网:http://qcustomplot.com/index.php/introduction

论坛:http://qcustomplot.com/index.php/support/forum

使用

在你的应用中使用QCustomPlot 有2种方法:

1、将下载下来的qcustomplot.h和qcustomplot.cpp加入你的工程中。在你要使用qcustomplot的文件中:

#include "qcustomplot.h"

然后像使用QWidget那样使用就行,因为QCustomPlot也是继承自QWidget的:

QCustomplot *myqcp = new QCustomPlot;

使用Qt Designer的话,在一个QWidget控件右键,提升为...,

QCustomPlot使用手册(一)_第3张图片

然后在弹出的对话框中,在提升为类名那里输入QCustomPlot,然后头文件那里会自动填充为qcustomplot.h。单击添加按钮将QCustomPlot加入提升类列表中,最后单击提升就可以了。

QCustomPlot使用手册(一)_第4张图片

注意:提升之后不会立即看到什么变化,但当你运行程序的时候,你就能看到控件具有坐标和网格了。

2、不用包含 qcustomplot.h和 qcustomplot.cpp,只需引入qcustomplot.so (GNU/Linux)或qcustomplot.dll(MSWindows) file。接下来说明如何编译qcustomplot库:

首先,从下载地址下载QCustomPlot-sharedlib,然后拷贝qcustomplot.h和qcustomplot.cpp到与qcustomplot-sharedlib同级的目录下,然后在命令行模式进入sharedlib-compilation目录,运行qmake;mingw32-make;稍等片刻就会产生俩个文件夹debug和release,里面分别有qcustomplot库的debug和release版本,windows是.dll,linux是.a(而官网说的是.so,有点出入?)然后怎么使用qcustomplot很简单,我就不说了- -

注意:如果你使用的Qt版本在5.0以上,需要在.pro文件中的QT变量加上printsupport,

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
这是因为Qt老版本不支持widgets和printsupport。

在QtCreator中使用帮助

在第二步下载的documentation文件夹下有个qcustomplot.qch文件,将它拷贝某个目录下,例如QtCreator的安装目录下,然后在QtCreator ,工具,选项,帮助,文档,添加,选择qcustomplot.qch文件,确定,以后按F1就能跳转到QCustomPlot的帮助文档了。

效果

QCustomPlot使用手册(一)_第5张图片QCustomPlot使用手册(一)_第6张图片QCustomPlot使用手册(一)_第7张图片QCustomPlot使用手册(一)_第8张图片QCustomPlot使用手册(一)_第9张图片QCustomPlot使用手册(一)_第10张图片QCustomPlot使用手册(一)_第11张图片QCustomPlot使用手册(一)_第12张图片QCustomPlot使用手册(一)_第13张图片QCustomPlot使用手册(一)_第14张图片QCustomPlot使用手册(一)_第15张图片QCustomPlot使用手册(一)_第16张图片QCustomPlot使用手册(一)_第17张图片QCustomPlot使用手册(一)_第18张图片

好了,第一篇,主要介绍QCustomPlot和它的搭建。

你可能感兴趣的:(qt)