1、下载和编译qwt
2、win7下环境的配置
可以不用qt designer来加载qwt里面的控件
3、demo:
.pro文件:
QT
+=
core
gui
TARGET
=
qwt_test
TEMPLATE
=
app
SOURCES
+=
main.cpp\
mainwindow.cpp
HEADERS
+=
mainwindow.h
FORMS
+=
mainwindow.ui
LIBS
+=
-L
"C:\QtSDK\Desktop\Qt\4.8.1\mingw\lib"
-lqwt
INCLUDEPATH
+=
"C:\QtSDK\Desktop\Qt\4.8.1\mingw\
include\QWT"
#qwt
setting
QWT_ROOT
=
C:/Qwt-6.1.2
LIBS
+=
-L
"D:\QtSDK\Desktop\Qt\4.8.1\mingw\lib"
-lqwt
INCLUDEPATH
+=
"D:\QtSDK\Desktop\Qt\4.8.1\mingw\
include\qwt"
include
(
${QWT_ROOT}/features/qwt.prf)
#end
qwt
setting
.h文件
#ifndef
MAINWINDOW_H
#define
MAINWINDOW_H
#include
<QMainWindow>
#include
"qwt_plot.h"
namespace
Ui
{
class
MainWindow
;
}
class
MainWindow
:
public
QMainWindow
{
Q_OBJECT
public
:
explicit
MainWindow
(
QWidget
*parent
=
0
);
~
MainWindow
();
QwtPlot
*qwtPlot
;
private
:
Ui
::
MainWindow
*ui
;
};
#endif
//
MAINWINDOW_H
.cpp
#include
"mainwindow.h"
#include
"ui_mainwindow.h"
MainWindow
::
MainWindow
(
QWidget
*parent
)
:
QMainWindow
(parent
),
ui
(
new
Ui
::
MainWindow
)
{
//
ui->setupUi(this);
this
->resize
(
800
,
480
);
qwtPlot
=
new
QwtPlot
(
this
);
qwtPlot
->setObjectName
(
QString
::fromUtf8
(
"qwtPlot"
));
qwtPlot
->setGeometry
(
QRect
(
0
,
20
,
400
,
200
));
}
MainWindow
::~
MainWindow
()
{
//
delete
ui;
}
运行结果: