qcustomplot学习笔记1-开发环境搭建

现在qt绘图大家用的比较多的还算是qwt和qcustomplot。qt官方出的qcharts,qt5.4以后才能用,嵌入式系统可能还是不怎么考虑。

以前用过qwt进行绘制,环境搭建的时间稍微麻烦一些。官方提供的库的使用教程不是源码形式使用,debug不太方便。qcustomplot加一个头文件和一个源文件就行,也可以debug方便很多。

1.代码下载

官方网站可以很方便下载:http://www.qcustomplot.com/

http://www.qcustomplot.com/index.php/download

2.把解压出来的源文件qcustomplot.cpp和qcustomplot.h拷贝到源文件目录,并把这两个文件加入.pro文件中。

添加后的.pro文件

#-------------------------------------------------
#
# Project created by QtCreator 2017-06-21T16:36:53
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

TARGET = qcp_1
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += main.cpp\
        mainwindow.cpp\
        qcustomplot.cpp

HEADERS  += mainwindow.h\
        qcustomplot.h

FORMS    += mainwindow.ui
3.在ui中添加一个QWidget,然后提升为QCustomPlot类

4.然后就可以正常使用QCustomPlot进行曲线绘制了。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值