qt5 有没有好用的绘制实时曲线的控件推荐

number007cool 2020-05-07 04:04:23
比如采集的温度的实时曲线,有没有好用的控件
...全文
1619 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
尘中远 2020-11-14
  • 打赏
  • 举报
回复
都qt5了,直接用QtChart,或者QCustomPlot
number007cool 2020-06-10
  • 打赏
  • 举报
回复
引用 17 楼 丁劲犇 的回复:
QtCharts比较摩登,qwt比较经典。 --------- 实时曲线,不管用什么工具,都要控制好刷新节奏。每秒20次,眼睛感觉顺畅就行了。切记使劲刷新。
为啥我在qt creator的控件栏找不到这两个控件呢, 搜索也没有啊, 我找的方式不对么?
  • 打赏
  • 举报
回复
QtCharts比较摩登,qwt比较经典。
---------
实时曲线,不管用什么工具,都要控制好刷新节奏。每秒20次,眼睛感觉顺畅就行了。切记使劲刷新。
青空飞羽 2020-05-29
  • 打赏
  • 举报
回复
Qt自带的QtChart模块就可以啊
DreamLife. 2020-05-29
  • 打赏
  • 举报
回复
我也一直是描点,小白,留名
number007cool 2020-05-28
  • 打赏
  • 举报
回复
引用 13 楼 南京短暂的春天 的回复:
qwt和customplot 这两个我们实际都用过 个人感觉,customplot更好
qt creator 自带,可以直接往里面拖?
  • 打赏
  • 举报
回复
qwt和customplot 这两个我们实际都用过 个人感觉,customplot更好
芒果黑 2020-05-18
  • 打赏
  • 举报
回复
QtChart
number007cool 2020-05-18
  • 打赏
  • 举报
回复
引用 11 楼 sevancheng 的回复:
qwtPlot
怎样添加到qt的项目中去呢 ,直接拖?
sevancheng 2020-05-18
  • 打赏
  • 举报
回复
qwtPlot
number007cool 2020-05-13
  • 打赏
  • 举报
回复
引用 6 楼 gucunlin 的回复:
Qt二维绘图肯定是Qwt呀,想什么呢。别听他们用paintEvent,能累死你。相信我。我用了近10年Qt了
qt开发环境中集成的么 还是第三方的库 需要安装
gucunlin 2020-05-13
  • 打赏
  • 举报
回复
Qt二维绘图肯定是Qwt呀,想什么呢。别听他们用paintEvent,能累死你。相信我。我用了近10年Qt了
slowlytalk 2020-05-13
  • 打赏
  • 举报
回复
QWt ,Qt中一个模块,paintEvent确实比较麻烦,QWt Qt例程中有好几个。
kalvenyan 2020-05-08
  • 打赏
  • 举报
回复
其实自己画条曲线并不难,动手吧。或者花钱
number007cool 2020-05-07
  • 打赏
  • 举报
回复
引用 3 楼 Italink 的回复:
[quote=引用 2 楼 number007cool的回复:][quote=引用 1 楼 Italink 的回复:] QWidget+QPainter就可以了
要自己绘制坐标系,然后一个个描点啊 感觉 好麻烦[/quote] 用QPainterPath可以画曲线,不用描点[/quote] 画了个, 没有坐标系, 没有 x y 轴, 有点粗糙

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    Init();
}


void MainWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setPen(QPen(Qt::red));

    QPoint origin(0,0);

    painter.translate(origin);
    painter.drawPath(*path);

    QMainWindow::paintEvent(event);
}



void MainWindow::Init()
{
    timer = new QTimer;
    point = new QPoint;
    path = new QPainterPath;

    p = t = 0;


    connect(ui->startBtn, SIGNAL(clicked()), this, SLOT(StartPaint()) );
    connect(ui->stopBtn, SIGNAL(clicked()), this, SLOT(StopPaint()) );
    connect(timer, SIGNAL(timeout()), this, SLOT(TimerUpdate()) );
}

void MainWindow::StartPaint()
{
    qDebug("start");
    timer->start(100);
}

void MainWindow::StopPaint()
{
     qDebug("stop");
     timer->stop();

     p = t = 0;
}

void MainWindow::TimerUpdate()
{
     qDebug("update");

     t += 10;
         //create random number
         QTime time;
         time= QTime::currentTime();
         qsrand(time.msec()+time.second()*1000);
         int rand=qrand()%this->height();
         //the next point of the painted line
         point->setX(t);
         point->setY(rand);
         path->lineTo(*point);

         //
         if(t > this->width())
         {
             p -= 10;
         }

         //in case update() method is called, the system will trigger paintEvent to repaint the window
         this->update();
}


MainWindow::~MainWindow()
{
    delete ui;
}


Italink 2020-05-07
  • 打赏
  • 举报
回复
引用 2 楼 number007cool的回复:
[quote=引用 1 楼 Italink 的回复:] QWidget+QPainter就可以了
要自己绘制坐标系,然后一个个描点啊 感觉 好麻烦[/quote] 用QPainterPath可以画曲线,不用描点
number007cool 2020-05-07
  • 打赏
  • 举报
回复
引用 1 楼 Italink 的回复:
QWidget+QPainter就可以了
要自己绘制坐标系,然后一个个描点啊 感觉 好麻烦
Italink 2020-05-07
  • 打赏
  • 举报
回复
QWidget+QPainter就可以了

16,173

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧