-
大小: 2KB文件類型: .cpp金幣: 1下載: 0 次發布日期: 2021-05-12
- 語言: C/C++
- 標簽: QCustomPlot??
資源簡介
使用QCustomPlot 類實現Qt實時波形繪制
可通過按鈕定時器等控制實時波形
代碼片段和文件信息
#include?“widget.h“
Widget::Widget(QWidget?*parent)
????:?QWidget(parent)
{
???QPushButton?*Button?=?new?QPushButton(this);
???Button->setText(“繪圖“);
???connect(Button&QPushButton::pressedthis&Widget::PlotDeal);
???QPushButton?*Button1?=?new?QPushButton(this);
???Button1->setText(“關閉“);
???Button1->move(1000);
???connect(Button1&QPushButton::pressedthis&Widget::PlotClose);
???timer?=?new?QTimer;?????????????//定時器
???connect(timer?SIGNAL(timeout())?this?SLOT(PlotReplot()));//定時器槽函數
???timer->start(500);????????????????//定時器定時時間
???cPlot.addGraph();
???cPlot.graph(0)->setName(“Data1“);
???cPlot.graph(0)->setPen(QPen(Qt::blue));
???cPlot.addGraph();
???cPlot.graph(1)->setName(“Data1“);
???cPlot.grap
- 上一篇:GSM 接收短信
- 下一篇:vigenere加密解密C語言代碼
評論
共有 條評論