Qwt 例子学习记1(animation)

3 篇文章 0 订阅
#include( $${PWD}/../examples.pri )//把原来的.pro文件这句去掉,改成下面的代替,我是编译完qwt再来看例子的,qwt目录下包涵所需要的头文件与库文件
 
 
INCLUDEPATH += .././qwt/
LIBS += .././qwtd.dll
QT += opengl         //因为需要使用到opengl.所以这句要加上.

#include <qapplication.h>

#include "plot.h"

#ifndef QWT_NO_OPENGL

#define USE_OPENGL 1

#endif

#if USE_OPENGL

//#include <qgl.h>

#include <QtOpenGL/qgl.h>

#include <qwt_plot_glcanvas.h>

#else

#include <qwt_plot_canvas.h>

#endif

int main ( int argc, char **argv )

{

#if USE_OPENGL

#if QT_VERSION >= 0x040600 && QT_VERSION < 0x050000

    // on my box QPaintEngine::OpenGL2 has serious problems, f.e:

    // the lines of a simple drawRect are wrong.

    QGL::setPreferredPaintEngine( QPaintEngine::OpenGL ); //OpengGL作为图形绘制引擎放在<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><pre name="code" class="cpp">QApplication a( argc, argv );之前

#endif

#endif

    QApplication a( argc, argv );

    Plot plot;

#if USE_OPENGL

    QwtPlotGLCanvas *canvas = new QwtPlotGLCanvas();

    canvas->setFrameStyle( QwtPlotGLCanvas::NoFrame );

#else

    QwtPlotCanvas *canvas = new QwtPlotCanvas();

    canvas->setFrameStyle( QFrame::NoFrame );

    canvas->setPaintAttribute( QwtPlotCanvas::BackingStore, false );

#endif

    plot.setCanvas( canvas );

    plot.setCanvasBackground( QColor( 30, 30, 50 ) );

    plot.resize( 400, 400 );

    plot.show();

    return a.exec();

}
 

 
 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值