VS+Qt中使用QCustomPlot绘制曲线标签(附源码)

在qt中我们常常会使用数据来绘制曲线,常用的的绘制方法用QCutomPlot、QChart和QPrinter。有时我们会根据需要在曲线进行二次绘制,包括对曲线打标签,显示某个点的值等功能。本文主要为大家介绍在QCustomPlot中使用QCPItemTracer和QCPItemText绘制跟随鼠标移动标签和鼠标双击标签线条。

在图表中常使用到自动跟随鼠标显示曲线当前的值。 

1、下面将介绍说明使用QCustomPlot绘制标签跟随鼠标移动标签。

第一步:创建一个空白的Qwidget并提升为QCustomPlot,并按照个人喜好初始化QCustomPlot设置对应的绘制样式。

第二步:初始化需要显示到QCustomPlot上标签对象,本文主要使用QCPItemTracer绘制标签和使用QCPItemText绘制标签文本。

第三步:准备一组曲线数据,并将数据绘制到QCustomPlot中。

第四步:绑定鼠标移动事件,移动鼠标,观察效果。

说太多,也懒得写了,老规则,直接上代码(代码只提供主要函数哦,有问题请私聊我哟)。

QCPItemTracer			*tracer = nullptr;QCPItemText				*tracerLabel = nullptr;QCPGraph				*tracerGraph;/*************************************************** * @brief: QCustomPlot初始化* @param: customPlot-指定对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPlotWidgetInit(QCustomPlot* customPlot){//设置默认追踪鼠标,否则在触发鼠标移动时,必须先点一下才有效this->setMouseTracking(true);customPlot->setMouseTracking(true);//信号-槽连接语句bool ret1 = connect(customPlot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(mouseDoubleClick(QMouseEvent*)));//信号-槽连接语句bool ret = connect(customPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoveEventSlot(QMouseEvent*)));customPlot->clearGraphs();QLinearGradient plotGradient;plotGradient.setColorAt(0, QColor(241, 245, 252));customPlot->setBackground(plotGradient);      // 设置背景颜色QList<QPen> str = { QPen(QColor(22,192,130)), QPen(QColor(50,90,208)), QPen(QColor(6,190,244)) ,QPen(QColor(136,122,242)), QPen(Qt::yellow) };QList<QBrush> strColor = { QBrush(QColor(0, 0, 255, 150)), QBrush(QColor(255, 255, 0, 150)), QBrush(QColor(255, 150, 0, 150)) };customPlot->addGraph();customPlot->graph(0)->setPen(str[0]); // 第一个图的线条颜色为蓝色customPlot->graph(0)->setSmooth(true);//添加平滑曲线customPlot->legend->setVisible(true);//显示图标customPlot->legend->setBorderPen(Qt::NoPen);//隐藏图标边框customPlot->legend->setBrush(QColor(255, 255, 255, 150));//设置图标灰色透明customPlot->legend->setTextColor(Qt::black);//设置图例文字颜色customPlot->legend->setFont(QFont("Helvetica", 10));//设置图标字体customPlot->legend->setMargins(QMargins(0, 0, 0, 0));//设置图标中图形与文字到边框距离customPlot->axisRect(0)->insetLayout()->setInsetAlignment(0, Qt::AlignTop | Qt::AlignRight);//设置图列居中customPlot->axisRect(0)->setBackground(QColor(255, 255, 255));//设置背景为黑色customPlot->xAxis->setTickLabelColor(Qt::black);//设置x轴文本颜色customPlot->xAxis->setBasePen(QPen(Qt::black));//设置x轴颜色customPlot->xAxis->setTickPen(QPen(Qt::black));customPlot->xAxis->setSubTickPen(QPen(Qt::black));customPlot->xAxis->grid()->setVisible(true);customPlot->xAxis->setSubTickLengthIn(0);       // 轴线内子刻度的长度customPlot->yAxis->setTickLabelColor(Qt::black);//设置y轴文本颜色customPlot->yAxis->setBasePen(QPen(Qt::black));//设置y轴颜色customPlot->yAxis->setTickPen(QPen(Qt::black));customPlot->yAxis->setSubTickPen(QPen(Qt::black));customPlot->yAxis->grid()->setVisible(true);// 使左轴和底轴的范围始终转移到右轴和顶轴connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));//设置横坐标为时间格式QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);timeTicker->setTimeFormat("%h:%m:%s");timeTicker->setTickCount(10);customPlot->xAxis->setTicker(timeTicker);customPlot->xAxis->setTickLabelRotation(0);//设置x轴时间旋转角度为30度customPlot->xAxis->setVisible(true);customPlot->graph(0)->rescaleAxes(true);customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);customPlot->setStyleSheet("background:#f1f5fc;");customPlot->replot();customPlot->layout()->update();customPlot->show();}/*************************************************** * @brief: QCustomPlotLabel初始化* @param: customPlot-指定对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPloLabelInit(QCustomPlot* customPlot){//生成游标if (tracer){tracer = nullptr;}tracer = new QCPItemTracer(customPlot); //生成游标tracer->setPen(QPen(Qt::red));//圆圈轮廓颜色tracer->setBrush(QBrush(Qt::red));//圆圈圈内颜色tracer->setStyle(QCPItemTracer::tsCircle);//圆圈tracer->setSize(10);//设置大小tracer->setVisible(false);//游标说明if (tracerLabel){tracerLabel = nullptr;}tracerLabel = new QCPItemText(customPlot); //生成游标说明tracerLabel->setLayer("overlay");//设置图层为overlay,因为需要频繁刷新//tracerLabel->setPen(QPen(Qt::red, Qt::NoPen));//设置游标说明颜色tracerLabel->setColor(Qt::red);tracerLabel->setBrush(Qt::NoBrush);tracerLabel->setPositionAlignment(Qt::AlignLeft | Qt::AlignTop);//左上tracerLabel->position->setParentAnchor(tracer->position);//将游标说明锚固在tracer位置处,实现自动跟随tracerLabel->setVisible(false);}/*************************************************** * @brief: QCustomPlot绘制曲线* @param: customPlot-指定对象;data-数据;key-关键字* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPlotWidgetShow(QCustomPlot* customPlot, QMap<int, QStringList> data, QString key){if (!customPlot || data.isEmpty()) return;QVector<double> x1, y1;double min = -10, max = 10;int index = -1;for (int i = 0; i < data.first().size(); i++){if (data.first()[i] == key){index = i; break;}}if (index == -1) return; // 未找到keyfor (int i = 1; i < data.size(); i++){x1.push_back(i);y1.push_back(data[i][index].toDouble());max = qMax(max, y1.last());min = qMin(min, y1.last());}if (min == 0) { min = -max; }if (x1.isEmpty() || y1.isEmpty()) return;customPlot->xAxis->setRange(x1.first(), x1.last());customPlot->yAxis->setRange(min*1.5, max*1.5);customPlot->graph(0)->setData(x1, y1);customPlot->graph(0)->setName(key);customPlot->replot();}/*************************************************** * @brief: 鼠标移动事件函数* @param: event-鼠标对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void mouseMoveEventSlot(QMouseEvent *event){if (ui.widget_alarmData->underMouse()){tracer->setVisible(true);tracerLabel->setVisible(true);}else{tracer->setVisible(false);tracerLabel->setVisible(false);}if (ui.widget_alarmData->graphCount() <= 0){return;}else{tracerGraph = ui.widget_alarmData->graph(0);tracer->setGraph(tracerGraph);}if (tracer == nullptr){return;}if (tracer->graph() == nullptr){return;}if (tracer->visible()){if (tracerGraph){double x = ui.widget_alarmData->xAxis->pixelToCoord(event->pos().x());tracer->setGraphKey(x);             //将游标横坐标设置成刚获得的横坐标数据xtracer->setInterpolating(true);   //自动计算y值,若只想看已有点,不需要这个tracer->updatePosition();           //使得刚设置游标的横纵坐标位置生效tracerLabel->setText(QString("time-%1\nvalue-%2").arg(QTime(0, 0, 0).addSecs(int(tracer->position->key())).toString(QString::fromLatin1("HH:mm:ss"))).arg(tracer->position->value()));ui.widget_alarmData->replot(QCustomPlot::rpQueuedReplot);}}}

鼠标跟踪自动显示效果图如下所示:

2、下面再提供在QCustomPlot上双击鼠标进行打标签的方法:

大致步骤和上面跟随鼠标移动打标签差不多,还是话不多说,直接上代码(代码只提供主要函数哦,有问题请私聊我哟)

QCPItemStraightLine		*vline_start = nullptr, *vline_end = nullptr;QCPItemText				*m_currentLabel_start = nullptr,*m_currentLabel_end = nullptr;QTime					startTime, stopTime;/*************************************************** * @brief: QCustomPlot初始化* @param: customPlot-指定对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPlotWidgetInit(QCustomPlot* customPlot){//设置默认追踪鼠标,否则在触发鼠标移动时,必须先点一下才有效this->setMouseTracking(true);customPlot->setMouseTracking(true);//信号-槽连接语句bool ret1 = connect(customPlot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(mouseDoubleClick(QMouseEvent*)));//信号-槽连接语句bool ret = connect(customPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoveEventSlot(QMouseEvent*)));customPlot->clearGraphs();QLinearGradient plotGradient;plotGradient.setColorAt(0, QColor(241, 245, 252));customPlot->setBackground(plotGradient);      // 设置背景颜色QList<QPen> str = { QPen(QColor(22,192,130)), QPen(QColor(50,90,208)), QPen(QColor(6,190,244)) ,QPen(QColor(136,122,242)), QPen(Qt::yellow) };QList<QBrush> strColor = { QBrush(QColor(0, 0, 255, 150)), QBrush(QColor(255, 255, 0, 150)), QBrush(QColor(255, 150, 0, 150)) };customPlot->addGraph();customPlot->graph(0)->setPen(str[0]); // 第一个图的线条颜色为蓝色customPlot->graph(0)->setSmooth(true);//添加平滑曲线customPlot->legend->setVisible(true);//显示图标customPlot->legend->setBorderPen(Qt::NoPen);//隐藏图标边框customPlot->legend->setBrush(QColor(255, 255, 255, 150));//设置图标灰色透明customPlot->legend->setTextColor(Qt::black);//设置图例文字颜色customPlot->legend->setFont(QFont("Helvetica", 10));//设置图标字体customPlot->legend->setMargins(QMargins(0, 0, 0, 0));//设置图标中图形与文字到边框距离customPlot->axisRect(0)->insetLayout()->setInsetAlignment(0, Qt::AlignTop | Qt::AlignRight);//设置图列居中customPlot->axisRect(0)->setBackground(QColor(255, 255, 255));//设置背景为黑色customPlot->xAxis->setTickLabelColor(Qt::black);//设置x轴文本颜色customPlot->xAxis->setBasePen(QPen(Qt::black));//设置x轴颜色customPlot->xAxis->setTickPen(QPen(Qt::black));customPlot->xAxis->setSubTickPen(QPen(Qt::black));customPlot->xAxis->grid()->setVisible(true);customPlot->xAxis->setSubTickLengthIn(0);       // 轴线内子刻度的长度customPlot->yAxis->setTickLabelColor(Qt::black);//设置y轴文本颜色customPlot->yAxis->setBasePen(QPen(Qt::black));//设置y轴颜色customPlot->yAxis->setTickPen(QPen(Qt::black));customPlot->yAxis->setSubTickPen(QPen(Qt::black));customPlot->yAxis->grid()->setVisible(true);// 使左轴和底轴的范围始终转移到右轴和顶轴connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));//设置横坐标为时间格式QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);timeTicker->setTimeFormat("%h:%m:%s");timeTicker->setTickCount(10);customPlot->xAxis->setTicker(timeTicker);customPlot->xAxis->setTickLabelRotation(0);//设置x轴时间旋转角度为30度customPlot->xAxis->setVisible(true);customPlot->graph(0)->rescaleAxes(true);customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);customPlot->setStyleSheet("background:#f1f5fc;");customPlot->replot();customPlot->layout()->update();customPlot->show();}/*************************************************** * @brief: QCustomPlotLabel初始化* @param: customPlot-指定对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPlotMarkLineInit(QCustomPlot* customPlot){if (vline_start){vline_start = nullptr;}// 设置游标垂直线vline_start = new QCPItemStraightLine(customPlot);vline_start->setLayer("overlay");// 超出坐标轴范围则不显示游标线vline_start->setClipToAxisRect(false);// 颜色随机vline_start->setPen(QPen(Qt::green, 1, Qt::DashLine));vline_start->setVisible(false);if (vline_end){vline_end = nullptr;}// 设置游标垂直线vline_end = new QCPItemStraightLine(customPlot);vline_end->setLayer("overlay");// 超出坐标轴范围则不显示游标线vline_end->setClipToAxisRect(false);// 颜色随机vline_end->setPen(QPen(Qt::blue, 1, Qt::DashLine));vline_end->setVisible(false);if (m_currentLabel_start){m_currentLabel_start = nullptr;}// 设置文本框m_currentLabel_start = new QCPItemText(customPlot);m_currentLabel_start->setLayer("overlay");// 超出坐标轴范围则不显示标签m_currentLabel_start->setClipToAxisRect(true);m_currentLabel_start->setPadding(QMargins(3, 3, 3, 3));m_currentLabel_start->setPen(QPen(QColor(130, 130, 130), 0, Qt::DotLine));m_currentLabel_start->setBrush(Qt::NoBrush);m_currentLabel_start->setFont(QFont("Arial", 8));m_currentLabel_start->setColor(Qt::green);m_currentLabel_start->setVisible(false);if (m_currentLabel_end){m_currentLabel_end = nullptr;}// 设置文本框m_currentLabel_end = new QCPItemText(customPlot);m_currentLabel_end->setLayer("overlay");// 超出坐标轴范围则不显示标签m_currentLabel_end->setClipToAxisRect(true);m_currentLabel_end->setPadding(QMargins(3, 3, 3, 3));m_currentLabel_end->setPen(QPen(QColor(130, 130, 130), 0, Qt::DotLine));m_currentLabel_end->setBrush(Qt::NoBrush);m_currentLabel_end->setFont(QFont("Arial", 8));m_currentLabel_end->setColor(Qt::blue);m_currentLabel_end->setVisible(false);}/*************************************************** * @brief: QCustomPlot绘制曲线* @param: customPlot-指定对象;data-数据;key-关键字* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void QCustomPlotWidgetShow(QCustomPlot* customPlot, QMap<int, QStringList> data, QString key){if (!customPlot || data.isEmpty()) return;QVector<double> x1, y1;double min = -10, max = 10;int index = -1;for (int i = 0; i < data.first().size(); i++){if (data.first()[i] == key){index = i; break;}}if (index == -1) return; // 未找到keyfor (int i = 1; i < data.size(); i++){x1.push_back(i);y1.push_back(data[i][index].toDouble());max = qMax(max, y1.last());min = qMin(min, y1.last());}if (min == 0) { min = -max; }if (x1.isEmpty() || y1.isEmpty()) return;customPlot->xAxis->setRange(x1.first(), x1.last());customPlot->yAxis->setRange(min*1.5, max*1.5);customPlot->graph(0)->setData(x1, y1);customPlot->graph(0)->setName(key);customPlot->replot();}/*************************************************** * @brief: 鼠标移动事件函数* @param: event-鼠标对象* @return : 无* @author :鬼魅* @date :2025-7-29 9:48:38***************************************************/void mouseDoubleClick(QMouseEvent *event){if (ui.widget_alarmData->underMouse()){if (vline_start == nullptr || vline_end == nullptr || m_currentLabel_start == nullptr || m_currentLabel_end == nullptr){return;}}double x = ui.widget_alarmData->xAxis->pixelToCoord(event->pos().x());double y = ui.widget_alarmData->yAxis->pixelToCoord(event->pos().y());if (event->button() == Qt::RightButton){// 画竖线,x为curtime,y只要0和1即可绘制直线了vline_end->point1->setCoords(x, 0);vline_end->point2->setCoords(x, 1);vline_end->setVisible(true);m_currentLabel_end->setVisible(false);// 可以设置显示位置跟随锚点的位置,此次我设置的是绝对位置,添加TAG用的m_currentLabel_end->position->setCoords(x, y);m_currentLabel_end->setText(QStringLiteral("结束时间"));stopTime = QTime(0, 0, 0).addSecs(quint64(x));if (startTime > stopTime){QMessageBox::information(this, tr("提示"), tr("结束时间必须大于开始时间!"));return;}m_currentLabel_end->setVisible(true);}else{// 画竖线,x为curtime,y只要0和1即可绘制直线了vline_start->point1->setCoords(x, 0);vline_start->point2->setCoords(x, 1);vline_start->setVisible(true);m_currentLabel_start->setVisible(false);// 可以设置显示位置跟随锚点的位置,此次我设置的是绝对位置,添加TAG用的m_currentLabel_start->position->setCoords(x, y);m_currentLabel_start->setText(QStringLiteral("开始时间"));startTime = QTime(0, 0, 0).addSecs(quint64(x));m_currentLabel_start->setVisible(true);}}

鼠标双击打标签显示效果图如下所示:

注:如果本文章对您有所帮助,请点赞收藏支持一下,谢谢。^_^

版权声明:本文为博主原创文章,转载请附上博文链接。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/pingmian/91219.shtml
繁体地址,请注明出处:http://hk.pswp.cn/pingmian/91219.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Spring Boot项目生产环境部署完整指南

在Spring Boot应用开发完成后&#xff0c;如何将其稳定、高效地部署到生产环境是每个开发者都需要掌握的关键技能。本文将详细介绍Spring Boot项目的多种部署方案&#xff0c;从传统部署到现代化容器部署&#xff0c;选择最适合的部署策略。 1. 部署前的准备工作 1.1 项目打包优…

微信小程序中实现页面跳转的方法

微信小程序中页面跳转主要有两种方式&#xff1a;声明式导航&#xff08;通过组件实现&#xff09;和编程式导航&#xff08;通过API实现&#xff09;。两种方式适用于不同场景&#xff0c;以下详细说明。一、声明式导航&#xff08;navigator组件&#xff09;通过小程序内置的…

从0开始学linux韦东山教程Linux驱动入门实验班(7)

本人从0开始学习linux&#xff0c;使用的是韦东山的教程&#xff0c;在跟着课程学习的情况下的所遇到的问题的总结,理论虽枯燥但是是基础。本人将前几章的内容大致学完之后&#xff0c;考虑到后续驱动方面得更多的开始实操&#xff0c;后续的内容将以韦东山教程Linux驱动入门实…

国内AI IDE竞逐:腾讯CodeBuddy、阿里通义灵码、字节跳动TRAE、百度文心快码

国内AI IDE竞逐&#xff1a;腾讯CodeBuddy、阿里通义灵码、字节跳动TRAE、百度文心快码 随着人工智能技术的不断发展&#xff0c;各大科技公司纷纷推出自家的AI IDE&#xff0c;推动软件开发进入全新的智能化时代。腾讯的 CodeBuddy IDE、阿里云的 通义灵码 AI IDE、字节跳动的…

git rebase使用教程 以及和merge的区别

Merge和Rebase概念概述 rebase 和 merge 相似&#xff0c;但又不完全相同&#xff0c;本质上都是用来合并分支的命令&#xff0c;区别如下 merge合并分支会多出一条merge commit记录&#xff0c;而rebase不会merge的提交树是非线性的&#xff0c;会有分叉&#xff0c;而rebase的…

React中的合成事件解释和理解

什么是合成事件&#xff08;Synthetic event&#xff09;?它和原生事件有什么区别?解题思路:解释合成事件&#xff0c;然后对比原生事件&#xff0c;然后再说他的优势1.一致性 在 react里面&#xff0c;这个合成事件是非常重要的&#xff0c;因为它就是为了解决浏览器之间与事…

【Python系列】使用 memory_profiler 诊断 Flask 应用内存问题

博客目录一、内存分析的重要性二、memory_profiler 基础使用安装与基本配置理解分析报告三、在 Flask 应用中使用 memory_profiler装饰视图函数使用 mprof 进行长期监控四、高级内存分析技巧精确测量代码块内存定期内存采样结合 objgraph 分析对象引用五、常见内存问题及解决方…

vue3【组件封装】超级表单 S-form.vue

最终效果 代码实现 components/SUI/S-form.vue <script lang"ts" setup> import type { FormInstance } from "element-plus";// 使用索引签名定义对象类型 type GenericObject {[key: string]: any; };const props defineProps<{Model?: Gen…

Android Studio Memory Monitor内存分析核心指标详解

Depth、Native Size、Shallow Size、Retained Size 解析 一、指标定义与对比指标定义计算逻辑重要性Shallow Size对象自身实例占用的内存基本类型字段大小 引用指针 内存对齐对象的基础内存成本Retained Size回收该对象可释放的总内存量&#xff08;含所有依赖对象&#xff0…

vue中使用wavesurfer.js绘制波形图和频谱图(支持.pcm)

新的实现方式&#xff1a;vue使用Canvas绘制频谱图 安装wavesurfer.js npm install wavesurfer.js第一版&#xff1a; 组件特点&#xff1a; 一次性加载好所有的数据&#xff1b; <template><div class"audio-visualizer-container"><div class&…

go mod教程、go module

什么是go mod go mod 是go语言的包管理工具&#xff0c;类似java 的maven&#xff0c;go mod的出现可以告别goPath&#xff0c;使用go module来管理项目&#xff0c;有了go mod账号就不需要非得把项目放到gopath/src目录下了&#xff0c;你可以在磁盘的任何位置新建一个项目 go…

150-SWT-MCNN-BiGRU-Attention分类预测模型等!

150-SWT-MCNN-BiGRU-Attention分类预测模型!基于多尺度卷积神经网络(MCNN)双向长短期记忆网络(BiGRU)注意力机制(Attention)的分类预测模型&#xff0c;matlab代码&#xff0c;直接运行使用&#xff01;1、模型介绍&#xff1a;针对传统方法在噪声环境下诊断精度低的问题&#…

MySQL数据一致性与主从延迟深度解析:从内核机制到生产实践

在高并发分布式系统中&#xff0c;数据一致性与复制延迟如同硬币的两面。本文深入剖析MySQL持久化机制与主从同步原理&#xff0c;并提供可落地的调优方案。一、数据持久化核心机制&#xff1a;双日志协同 1. Redo Log&#xff1a;崩溃恢复的生命线刷新策略&#xff08;innodb_…

【I】题目解析

目录 单选题 多选题 判断题 单选题 1.reg[7:0]A; A2hFF;则A&#xff08;&#xff09; A.8b11111110 B.8b03 C.8b00000011 D.8b11111111 C 2hFF实际上等效于2位二进制2b11&#xff0c;赋值给8位寄存器A之后&#xff0c;低位赋值&#xff0c;高位补0 A8b00000011 AMD FPG…

《Foundation 面板:设计、功能与最佳实践解析》

《Foundation 面板:设计、功能与最佳实践解析》 引言 在当今数字化时代,用户界面(UI)设计的重要性不言而喻。其中,Foundation 面板作为一种流行的前端框架,因其灵活性和高效性而被众多开发者所青睐。本文将深入解析 Foundation 面板的设计理念、功能特点以及最佳实践,…

React服务端渲染 Next 使用详解

1. Next.js 概述 Next.js 是一个基于 React 的开源框架&#xff0c;专注于服务器端渲染&#xff08;SSR&#xff09;和静态站点生成&#xff08;SSG&#xff09;&#xff0c;提供开箱即用的 SSR 功能&#xff0c;简化 React 应用的开发与部署。 2. Next.js 的核心特性 SSR 支…

Deforum Stable Diffusion,轻松实现AI视频生成自由!

摘要&#xff1a; 你是否曾被那些充满想象力、画面流畅的AI视频所震撼&#xff1f;你是否也想亲手创造出属于自己的AI动画&#xff1f;本文将为你提供一份“保姆级”的详尽教程&#xff0c;从环境配置到参数调整&#xff0c;一步步带你复现强大的Deforum Stable Diffusion模型&…

不同环境安装配置redis

不同环境安装配置redis windows 环境安装redis redis所有下载地址 windows版本redis下载&#xff08;GitHub&#xff09;&#xff1a; https://github.com/tporadowski/redis/releases &#xff08;推荐使用&#xff09;https://github.com/MicrosoftArchive/redis/releases]官…

汇川Easy系列PLC算法系列(回溯法ST语言实现)

Easy系列PLC 3次多项式轨迹插补算法 Easy系列PLC 3次多项式轨迹插补算法(完整ST代码)_plc连续插补算法-CSDN博客文章浏览阅读122次。INbExecuteBOOLOFFOFF不保持1INrStartPosREAL0.0000000.000000不保持起始位置unit2INrEndPosREAL0.0000000.000000不保持结束位置unit3INrStar…

Linux C:构造数据类型

目录 一、结构体&#xff08;struct&#xff09; 1.1类型定义 1.2 结构体变量定义 1.3 结构体元素初始化 1.4 结构体成员访问 1.5 结构体的存储&#xff08;内存对齐&#xff09; 1.6 结构体传参 本文主要记录了C语言中构造数据类型部分的内容&#xff0c;今天暂时只写了…