Win7下安装与使用Qwt

使用的平台、软件与文件

Windows 7 专业版 64bit

qt-opensource-windows-x86-mingw530-5.7.0

qwt-6.1.3.zip

qwt-6.1.3.qch

安装步骤

  1. 搭建好Qt环境
  2. 下载qwt-6.1.3.qch;下载qwt-6.1.3.zip并将其中的“qwt-6.1.3”文件夹解压至任意位置(如C:\;以下内容以此位置为例)
  3. 把qwt-6.1.3.qch移动到“C:\Qt\Qt5.7.0\Docs\Qt-5.7”中
  4. 找到并打开Qt 5.7 for Desktop (MinGW 5.3.0 32 bit)这个命令行环境(在开始菜单中可以找到),输入以下命令
    cd C:\qwt-6.1.3
    qmake qwt.pro
    mingw32-make
    mingw32-make install
  5. 编译、安装完成后应该出现以下文件夹
  6. 把“C:\qwt-6.1.3\lib”中的"*.dll"复制到“C:\Qt\Qt5.7.0\5.7\mingw53_32\bin”中
  7. 把“C:\qwt-6.1.3\lib”中的"*.a"复制到“C:\Qt\Qt5.7.0\5.7\mingw53_32\lib”中
  8. 把“C:\qwt-6.1.3\designer\plugins\designer”中的"*.dll"复制到“C:\Qt\Qt5.7.0\5.7\mingw53_32\plugins\designer”中
  9. 在“C:\Qt\Qt5.7.0\5.7\mingw53_32\include”中新建“Qwt”文件夹,把“C:\qwt-6.1.3\src”中的"*.h"复制到“C:\Qt\Qt5.7.0\5.7\mingw53_32\include\Qwt”中

测试与使用

  1. 新建一个工程,在main.cpp中添加以下内容
    #include <QApplication>
    #include <qwt_plot.h>
    #include <qwt_plot_curve.h>
    #include <qwt_plot_grid.h>
    #include <qwt_symbol.h>
    #include <qwt_legend.h>
    
    int main( int argc, char **argv )
    {
        QApplication a( argc, argv );
    
        QwtPlot plot;
        plot.setTitle( "Plot Demo" );
        plot.setCanvasBackground( Qt::white );
        plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
        plot.insertLegend( new QwtLegend() );
    
        QwtPlotGrid *grid = new QwtPlotGrid();
        grid->attach( &plot );
    
        QwtPlotCurve *curve = new QwtPlotCurve();
        curve->setTitle( "Some Points" );
        curve->setPen( Qt::blue, 4 ),
        curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    
        QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
            QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
        curve->setSymbol( symbol );
    
        QPolygonF points;
        points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
            << QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
            << QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
        curve->setSamples( points );
    
        curve->attach( &plot );
    
        plot.resize( 600, 400 );
        plot.show();
    
        return a.exec();
    }
    
  2. 在需要使用Qwt的工程的.pro文件中添加以下内容
    QWT_LIB_DIR = "C:\Qt\Qt5.7.0\5.7\mingw53_32\lib"
    QWT_INCLUDE_DIR = "C:\Qt\Qt5.7.0\5.7\mingw53_32\include\Qwt"
    LIBS += -L$${QWT_LIB_DIR} \
            -lqwt \
            -lqwtd
    INCLUDEPATH += $${QWT_INCLUDE_DIR}
  3. 把build configuration设置为“Release”

参考资料

  • http://blog.chinaunix.net/uid-20717410-id-2939720.html
  • http://blog.csdn.net/tangtao_xp/article/details/8875327
  • http://www.mamicode.com/info-detail-500572.html
  • http://chen84769797.blog.163.com/blog/static/111620934201321101753721/
  • http://blog.hehehehehe.cn/a/10158.htm
  • http://www.qtcentre.org/threads/53787-HowTo-Installation-of-Qt-5-0-1-and-Qwt-6-1-0-rc3-%28Win7-64bit%29
  • qwt-6.1.3.pdf
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值