## 一、前言

QWT,全称是QT Widgets for Technical Applications,是一个基于LGPL版权协议的开源项目,可生成各种统计图。为具有技术专业背景的程序提供GUI组件和一组实用类,其目标是以基于2D方式的窗体部件来显示数据, 数据源以数值,数组或一组浮点数等方式提供,输出方式可以是Curves(曲线),Slider(滚动条),Dials(圆盘),Compasses(仪表盘)等等。该工具库基于Qt开发,所以也继承了Qt的跨平台特性。

在Qt做项目中,如果需要用到曲线的话,很可能会用到qwt组件,但是很多初学者苦于编译的种种烦恼,比如默认qwt是插件的形式提供的,需要编译成你对应编译器的插件动态库,然后引入头文件链接动态库再用,甚至有些初学者想直接集成到qtcreator中,发现怎么都搞不定,烦啊,搞得一点兴趣都没有了,其实默认Qt的安装包自带的mingw编译器,很多人默认选择的也是mingw编译器的Qt,而安装包中的Qtcreator呢又是msvc编译器编译的,因为版本不对所以无法集成,那怎么办呢,用户其实很多时候只需要new一个类出来放对应的布局或者窗体上即可,然后调用对应的方法来设置和处理,根本不想这么复杂,于是抽点时间将qwt中的所有控件的完整源码抽取出来,直接源码集成到你的项目,在你的项目只需要引入pri文件即可,永远不要再去搞烦人的编译插件了。

## 二、代码思路

QT = core gui greaterThan(QT_MAJOR_VERSION, 4): QT = widgets printsupport concurrent DEFINES = QWT_NO_SVG QWT_NO_OPENGL INCLUDEPATH = $$PWD HEADERS = \ $$PWD/qwt.h \ $$PWD/qwt_abstract_legend.h \ $$PWD/qwt_abstract_scale.h \ $$PWD/qwt_abstract_scale_draw.h \ $$PWD/qwt_abstract_slider.h \ $$PWD/qwt_analog_clock.h \ $$PWD/qwt_arrow_button.h \ $$PWD/qwt_clipper.h \ $$PWD/qwt_color_map.h \ $$PWD/qwt_column_symbol.h \ $$PWD/qwt_compass.h \ $$PWD/qwt_compass_rose.h \ $$PWD/qwt_compat.h \ $$PWD/qwt_counter.h \ $$PWD/qwt_curve_fitter.h \ $$PWD/qwt_date.h \ $$PWD/qwt_date_scale_draw.h \ $$PWD/qwt_date_scale_engine.h \ $$PWD/qwt_dial.h \ $$PWD/qwt_dial_needle.h \ $$PWD/qwt_dyngrid_layout.h \ $$PWD/qwt_event_pattern.h \ $$PWD/qwt_global.h \ $$PWD/qwt_graphic.h \ $$PWD/qwt_interval.h \ $$PWD/qwt_interval_symbol.h \ $$PWD/qwt_knob.h \ $$PWD/qwt_legend.h \ $$PWD/qwt_legend_data.h \ $$PWD/qwt_legend_label.h \ $$PWD/qwt_magnifier.h \ $$PWD/qwt_math.h \ $$PWD/qwt_matrix_raster_data.h \ $$PWD/qwt_null_paintdevice.h \ $$PWD/qwt_painter.h \ $$PWD/qwt_painter_command.h \ $$PWD/qwt_panner.h \ $$PWD/qwt_picker.h \ $$PWD/qwt_picker_machine.h \ $$PWD/qwt_pixel_matrix.h \ $$PWD/qwt_plot.h \ $$PWD/qwt_plot_abstract_barchart.h \ $$PWD/qwt_plot_barchart.h \ $$PWD/qwt_plot_canvas.h \ $$PWD/qwt_plot_curve.h \ $$PWD/qwt_plot_dict.h \ $$PWD/qwt_plot_directpainter.h \ $$PWD/qwt_plot_grid.h \ $$PWD/qwt_plot_histogram.h \ $$PWD/qwt_plot_intervalcurve.h \ $$PWD/qwt_plot_item.h \ $$PWD/qwt_plot_layout.h \ $$PWD/qwt_plot_legenditem.h \ $$PWD/qwt_plot_magnifier.h \ $$PWD/qwt_plot_marker.h \ $$PWD/qwt_plot_multi_barchart.h \ $$PWD/qwt_plot_panner.h \ $$PWD/qwt_plot_picker.h \ $$PWD/qwt_plot_rasteritem.h \ $$PWD/qwt_plot_renderer.h \ $$PWD/qwt_plot_rescaler.h \ $$PWD/qwt_plot_scaleitem.h \ $$PWD/qwt_plot_seriesitem.h \ $$PWD/qwt_plot_shapeitem.h \ $$PWD/qwt_plot_spectrocurve.h \ $$PWD/qwt_plot_spectrogram.h \ $$PWD/qwt_plot_textlabel.h \ $$PWD/qwt_plot_tradingcurve.h \ $$PWD/qwt_plot_zoneitem.h \ $$PWD/qwt_plot_zoomer.h \ $$PWD/qwt_point_3d.h \ $$PWD/qwt_point_data.h \ $$PWD/qwt_point_mapper.h \ $$PWD/qwt_point_polar.h \ $$PWD/qwt_raster_data.h \ $$PWD/qwt_round_scale_draw.h \ $$PWD/qwt_samples.h \ $$PWD/qwt_sampling_thread.h \ $$PWD/qwt_scale_div.h \ $$PWD/qwt_scale_draw.h \ $$PWD/qwt_scale_engine.h \ $$PWD/qwt_scale_map.h \ $$PWD/qwt_scale_widget.h \ $$PWD/qwt_series_data.h \ $$PWD/qwt_series_store.h \ $$PWD/qwt_slider.h \ $$PWD/qwt_spline.h \ $$PWD/qwt_symbol.h \ $$PWD/qwt_system_clock.h \ $$PWD/qwt_text.h \ $$PWD/qwt_text_engine.h \ $$PWD/qwt_text_label.h \ $$PWD/qwt_thermo.h \ $$PWD/qwt_transform.h \ $$PWD/qwt_wheel.h \ $$PWD/qwt_widget_overlay.h SOURCES = \ $$PWD/qwt_abstract_legend.cpp \ $$PWD/qwt_abstract_scale.cpp \ $$PWD/qwt_abstract_scale_draw.cpp \ $$PWD/qwt_abstract_slider.cpp \ $$PWD/qwt_analog_clock.cpp \ $$PWD/qwt_arrow_button.cpp \ $$PWD/qwt_clipper.cpp \ $$PWD/qwt_color_map.cpp \ $$PWD/qwt_column_symbol.cpp \ $$PWD/qwt_compass.cpp \ $$PWD/qwt_compass_rose.cpp \ $$PWD/qwt_counter.cpp \ $$PWD/qwt_curve_fitter.cpp \ $$PWD/qwt_date.cpp \ $$PWD/qwt_date_scale_draw.cpp \ $$PWD/qwt_date_scale_engine.cpp \ $$PWD/qwt_dial.cpp \ $$PWD/qwt_dial_needle.cpp \ $$PWD/qwt_dyngrid_layout.cpp \ $$PWD/qwt_event_pattern.cpp \ $$PWD/qwt_graphic.cpp \ $$PWD/qwt_interval.cpp \ $$PWD/qwt_interval_symbol.cpp \ $$PWD/qwt_knob.cpp \ $$PWD/qwt_legend.cpp \ $$PWD/qwt_legend_data.cpp \ $$PWD/qwt_legend_label.cpp \ $$PWD/qwt_magnifier.cpp \ $$PWD/qwt_math.cpp \ $$PWD/qwt_matrix_raster_data.cpp \ $$PWD/qwt_null_paintdevice.cpp \ $$PWD/qwt_painter.cpp \ $$PWD/qwt_painter_command.cpp \ $$PWD/qwt_panner.cpp \ $$PWD/qwt_picker.cpp \ $$PWD/qwt_picker_machine.cpp \ $$PWD/qwt_pixel_matrix.cpp \ $$PWD/qwt_plot.cpp \ $$PWD/qwt_plot_abstract_barchart.cpp \ $$PWD/qwt_plot_axis.cpp \ $$PWD/qwt_plot_barchart.cpp \ $$PWD/qwt_plot_canvas.cpp \ $$PWD/qwt_plot_curve.cpp \ $$PWD/qwt_plot_dict.cpp \ $$PWD/qwt_plot_directpainter.cpp \ $$PWD/qwt_plot_grid.cpp \ $$PWD/qwt_plot_histogram.cpp \ $$PWD/qwt_plot_intervalcurve.cpp \ $$PWD/qwt_plot_item.cpp \ $$PWD/qwt_plot_layout.cpp \ $$PWD/qwt_plot_legenditem.cpp \ $$PWD/qwt_plot_magnifier.cpp \ $$PWD/qwt_plot_marker.cpp \ $$PWD/qwt_plot_multi_barchart.cpp \ $$PWD/qwt_plot_panner.cpp \ $$PWD/qwt_plot_picker.cpp \ $$PWD/qwt_plot_rasteritem.cpp \ $$PWD/qwt_plot_renderer.cpp \ $$PWD/qwt_plot_rescaler.cpp \ $$PWD/qwt_plot_scaleitem.cpp \ $$PWD/qwt_plot_seriesitem.cpp \ $$PWD/qwt_plot_shapeitem.cpp \ $$PWD/qwt_plot_spectrocurve.cpp \ $$PWD/qwt_plot_spectrogram.cpp \ $$PWD/qwt_plot_textlabel.cpp \ $$PWD/qwt_plot_tradingcurve.cpp \ $$PWD/qwt_plot_xml.cpp \ $$PWD/qwt_plot_zoneitem.cpp \ $$PWD/qwt_plot_zoomer.cpp \ $$PWD/qwt_point_3d.cpp \ $$PWD/qwt_point_data.cpp \ $$PWD/qwt_point_mapper.cpp \ $$PWD/qwt_point_polar.cpp \ $$PWD/qwt_raster_data.cpp \ $$PWD/qwt_round_scale_draw.cpp \ $$PWD/qwt_sampling_thread.cpp \ $$PWD/qwt_scale_div.cpp \ $$PWD/qwt_scale_draw.cpp \ $$PWD/qwt_scale_engine.cpp \ $$PWD/qwt_scale_map.cpp \ $$PWD/qwt_scale_widget.cpp \ $$PWD/qwt_series_data.cpp \ $$PWD/qwt_slider.cpp \ $$PWD/qwt_spline.cpp \ $$PWD/qwt_symbol.cpp \ $$PWD/qwt_system_clock.cpp \ $$PWD/qwt_text.cpp \ $$PWD/qwt_text_engine.cpp \ $$PWD/qwt_text_label.cpp \ $$PWD/qwt_thermo.cpp \ $$PWD/qwt_transform.cpp \ $$PWD/qwt_wheel.cpp \ $$PWD/qwt_widget_overlay.cpp

## 三、效果图

qt对接webapi(Qt开源作品34-qwt无需插件源码)(1)

## 四、开源主页

**以上作品完整源码下载都在开源主页,会持续不断更新作品数量和质量,欢迎各位关注。**

1. 国内站点:[https://gitee.com/feiyangqingyun/QWidgetDemo](https://gitee.com/feiyangqingyun/QWidgetDemo)

2. 国际站点:[https://github.com/feiyangqingyun/QWidgetDemo](https://github.com/feiyangqingyun/QWidgetDemo)

3. 个人主页:[https://blog.csdn.net/feiyangqingyun](https://blog.csdn.net/feiyangqingyun)

4. 知乎主页:[https://www.zhihu.com/people/feiyangqingyun/](https://www.zhihu.com/people/feiyangqingyun/)

,