QT绘画仪表盘

代码一步一步讲,就不写用啥之类的了,暗部走来,自己找使用的类以及使用方法

1、创建工程

2、重载paintEvent

#include <QMainWindow>
#include <QPainter>
#include <QPaintEvent>
protected:virtual void paintEvent(QPaintEvent *event);
void MainWindow::paintEvent(QPaintEvent *event)
{}

3、构建绘画对象,调整表盘位置、画笔位置、刷子之类的

    //创建对象QPainter m_painter(this);//表盘宽度不变,高度-100,中心位置在前面两个小的的中间int m_width = this->width();int m_height = this->height() - 100;int radius = ((m_width > m_height)?m_height:m_width)/2.0;//移动画笔到中下方位置m_painter.translate(m_width/2,m_height*0.6);//启用反锯齿m_painter.setRenderHint(QPainter::Antialiasing, true);m_painter.setPen(Qt::NoPen);//设置画刷颜色m_painter.setBrush(QColor(138,43,226));

4、画刻度线

//刻度线DrawSmallScale(m_painter, radius - 60);
private:void DrawSmallScale(QPainter & painter, int radius);
void MainWindow::DrawSmallScale(QPainter & painter, int radius)
{//组装点路径图(刻度)QPainterPath pointPath_small;pointPath_small.moveTo(-2, -2);pointPath_small.lineTo(2, -2);pointPath_small.lineTo(2, 8);pointPath_small.lineTo(-2, 8);QPainterPath pointPath_big;pointPath_big.moveTo(-2, -2);pointPath_big.lineTo(2, -2);pointPath_big.lineTo(2, 20);pointPath_big.lineTo(-2, 20);//绘制61个小点for(int i = 0; i < 121; i += 2){QPointF point(0, 0);painter.save();point.setX(radius* qCos(((210-i*2)*M_PI)/180));point.setY(radius* qSin(((-210+i*2)*M_PI)/180));painter.translate(point.x(), point.y());painter.rotate(-120+i*2);if(i<80){painter.setBrush(QColor(0, 0, 0));}if(i>=80){painter.setBrush(QColor(235, 70, 70));}if(i%5 == 0){painter.drawPath(pointPath_big);//绘画大刻度}else{painter.drawPath(pointPath_small);//绘画小刻度}painter.restore();}
}

5、刻度数字

    //刻度数字DrawDigital(m_painter, radius - 90);
void DrawDigital(QPainter & painter, int radius);
void MainWindow::DrawDigital(QPainter &painter, int radius)
{//设置画笔,画笔默认NOPENpainter.setPen(QColor(0, 0, 0));QFont font;font.setFamily("Arical");font.setPointSize(15);font.setBold(true);painter.setFont(font);for(int i=0;i<13;++i){QPointF point(0, 0);painter.save();point.setX(radius* qCos(((210-i*20)*M_PI)/180));point.setY(radius* qSin(((210-i*20)*M_PI)/180));painter.translate(point.x(), -point.y());painter.rotate(-120+i*20);painter.drawText(-25, 0, 50, 20, Qt::AlignCenter, QString::number(i*20));painter.restore();}//还原画笔painter.setPen(Qt::NoPen);
}

6、逐渐发光外扇形

/*所有形状绘画*///逐渐发光外扇形DrawCircle(m_painter, radius - 35);
void DrawCircle(QPainter & painter, int radius);
void MainWindow::DrawCircle(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath outRing;QPainterPath inRing;outRing.moveTo(0,0);inRing.moveTo(0,0);outRing.arcTo(-radius, -radius, 2*radius, 2*radius, -30, 240);inRing.addEllipse(-radius+50, -radius+50, 2*(radius-50), 2*(radius-50));outRing.closeSubpath();//设置渐变色QRadialGradient radialGradient(0,0,radius,0,0);radialGradient.setColorAt(1, QColor(0,82,199));radialGradient.setColorAt(0.92, Qt::transparent);//设置画刷painter.setBrush(radialGradient);//大圆减小圆painter.drawPath(outRing.subtracted(inRing));//恢复painter.restore();
}

7、指针

void DrawPointer(QPainter & painter, int radius);
//指针DrawPointer(m_painter, radius-130);
void MainWindow::DrawPointer(QPainter &painter, int radius)
{//组装点路径图QPainterPath pointPath;pointPath.moveTo(10,0);pointPath.lineTo(1,-radius);pointPath.lineTo(-1,-radius);pointPath.lineTo(-10,0);pointPath.arcTo(-10,0,20,20,180,180);QPainterPath inRing;inRing.addEllipse(-5,-5,10,10);painter.save();//计算并选择绘图对象坐标painter.rotate(degRotate-120);painter.setBrush(QColor(255,0,0));painter.drawPath(pointPath.subtracted(inRing));painter.restore();
}

8、最外细圆圈

void DrawCircle_line(QPainter & painter, int radius);
//最外细圆圈DrawCircle_line(m_painter, radius-35);
void MainWindow::DrawCircle_line(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath outRing;QPainterPath inRing;outRing.moveTo(0,0);inRing.moveTo(0,0);outRing.arcTo(-radius,-radius,2*radius,2*radius,-30,240);inRing.addEllipse(-radius+2,-radius+2,2*(radius-2),2*(radius-2));outRing.closeSubpath();//设置画刷painter.setBrush(QColor(5,228,255));//大圆减小圆painter.drawPath(outRing.subtracted(inRing));painter.restore();
}

9、中间大圆

void DrawCircle_bom_big(QPainter & painter, int radius);
//中间大圆DrawCircle_bom_big(m_painter, radius-150);
void MainWindow::DrawCircle_bom_big(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath inRing;inRing.moveTo(0,0);inRing.addEllipse(-radius+50,-radius+50,2*(radius-50),2*(radius-50));//设置画刷painter.setBrush(QColor(10,20,30));painter.drawPath(inRing);painter.restore();
}

10、逐渐发光内圈

void DrawCircle_bom_shine(QPainter & painter, int radius);
//逐渐发光内圈DrawCircle_bom_shine(m_painter, radius-230);
void MainWindow::DrawCircle_bom_shine(QPainter &painter, int radius)
{//保存绘图对象painter.save();//渐变色QRadialGradient radialGradient(0,0,radius,0,0);radialGradient.setColorAt(0.5,QColor(10,68,185,150));radialGradient.setColorAt(1.0,Qt::transparent);painter.setBrush(QBrush(radialGradient));painter.drawRect(-radius,-radius,2*radius,2*radius);painter.restore();
}

11、中间小圆

void DrawCircle_bom_small(QPainter & painter, int radius);
//中间小圆DrawCircle_bom_small(m_painter, radius-200);
void MainWindow::DrawCircle_bom_small(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath inRing;inRing.moveTo(0,0);inRing.addEllipse(-radius+50,-radius+50,2*(radius-50),2*(radius-50));//设置画刷painter.setBrush(QColor(10,20,30));painter.drawPath(inRing);painter.restore();
}

12、动态扇形环

void DrawCircle_arc(QPainter & painter, int radius);
//动态扇形环DrawCircle_arc(m_painter, radius-40);
void MainWindow::DrawCircle_arc(QPainter &painter, int radius)
{QRect rect(-radius, -radius, 2*radius, 2*radius);QConicalGradient Conical(0,0,-70);Conical.setColorAt(0.1, QColor(255,88,127,200));//红色Conical.setColorAt(0.5, QColor(53,179,251,150));//蓝色painter.setBrush(Conical);painter.drawPie(rect, 210*16, -(degRotate)*16);
}

由于是动态的,需要加入定时器与按键事件模拟加减速

13、单位与时速

固定下窗口大小

setFixedSize(1280,800);

定义一些全局变量

private:int degRotate = 0;int radius;//仪表盘中心位置int direction;//指针运动的方向,1为前进,0为后退

画表盘文字

void DrawUnit(QPainter & painter, int radius);void DrawNum(QPainter & painter, int radius);
//单位DrawUnit(m_painter,radius-390);//时速DrawNum(m_painter,radius-300);
void MainWindow::DrawUnit(QPainter &painter, int radius)
{//保存绘图对象painter.save();//设置笔painter.setPen(QColor(255,255,255));//设置字体QFont font;font.setFamily("Arial");font.setPointSize(16);font.setBold(true);painter.setFont(font);//画文字painter.drawText(-50,-radius,100,20,Qt::AlignCenter,QString("km/h"));painter.setPen(QColor(0,0,0));painter.drawText(-60,-radius+130,120,40,Qt::AlignCenter,QString("当前车速"));painter.setPen(QColor(0,0,0,50));painter.drawText(-120,-radius+280,250,40,Qt::AlignCenter,QString("-请按space键加速-"));painter.restore();
}void MainWindow::DrawNum(QPainter &painter, int radius)
{//保存绘图对象painter.save();//设置笔painter.setPen(QColor(255,255,255));//设置字体QFont font;font.setFamily("Arial");font.setPointSize(45);painter.setFont(font);//写文字painter.drawText(-75,-radius-20,150,100,Qt::AlignCenter,QString::number(degRotate));painter.restore();
}

14、按键事件

添加定时器和按键事件的头文件

#include <QTimer>
#include <QKeyEvent>

重写按键虚函数

    virtual void mousePressEvent(QMouseEvent *event);virtual void mouseReleaseEvent(QMouseEvent *event);
void MainWindow::mousePressEvent(QMouseEvent *event)
{if(event->key() == Qt::Key_Space){if(direction == 0){myTimer->start(1);direction = 1;}}
}void MainWindow::mouseReleaseEvent(QMouseEvent *event)
{if(event->key() == Qt::Key_Space)direction = 0;
}

构建定时器对象

private:int degRotate = 0;int radius;//仪表盘中心位置int direction;//指针运动的方向,1为前进,0为后退QTimer *myTimer;
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);setFixedSize(1280,800);//定时器myTimer = new QTimer(this);connect(myTimer, SIGNAL(timeout()), this, SLOT(slot_seed_changed()));
}

新建速度变化的槽函数

private slots:void slot_seed_changed();
void MainWindow::slot_seed_changed()
{if(direction == 1)//加速{degRotate++;if(degRotate > 240){degRotate = 240;}}else if(direction == 0)//减速{degRotate--;if(degRotate<0){degRotate = 0;myTimer->stop();}}update();//刷新画面
}

15、动画效果

汽车仪表盘

16、完整代码

#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QPainter>
#include <QPaintEvent>
#include <QtMath>#include <QTimer>
#include <QKeyEvent>QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACEclass MainWindow : public QMainWindow
{Q_OBJECTpublic:MainWindow(QWidget *parent = nullptr);~MainWindow();private:Ui::MainWindow *ui;protected:virtual void paintEvent(QPaintEvent *event);virtual void keyPressEvent(QKeyEvent *event);virtual void keyReleaseEvent(QKeyEvent *event);private:void DrawSmallScale(QPainter & painter, int radius);void DrawDigital(QPainter & painter, int radius);void DrawCircle(QPainter & painter, int radius);void DrawCircle_arc(QPainter & painter, int radius);void DrawPointer(QPainter & painter, int radius);void DrawCircle_line(QPainter & painter, int radius);void DrawCircle_bom_big(QPainter & painter, int radius);void DrawCircle_bom_shine(QPainter & painter, int radius);void DrawCircle_bom_small(QPainter & painter, int radius);void DrawUnit(QPainter & painter, int radius);void DrawNum(QPainter & painter, int radius);private:int degRotate = 0;int radius;//仪表盘中心位置int direction;//指针运动的方向,1为前进,0为后退QTimer *myTimer;private slots:void slot_seed_changed();
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);setFixedSize(1280,800);//定时器myTimer = new QTimer(this);connect(myTimer, SIGNAL(timeout()), this, SLOT(slot_seed_changed()));
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::paintEvent(QPaintEvent *event)
{//创建对象QPainter m_painter(this);//表盘宽度不变,高度-100,中心位置在前面两个小的的中间int m_width = this->width();int m_height = this->height() - 100;int radius = ((m_width > m_height)?m_height:m_width)/2.0;//移动画笔到中下方位置m_painter.translate(m_width/2,m_height*0.6);//启用反锯齿m_painter.setRenderHint(QPainter::Antialiasing, true);m_painter.setPen(Qt::NoPen);//设置画刷颜色m_painter.setBrush(QColor(138,43,226));//刻度线DrawSmallScale(m_painter, radius - 60);//刻度数字DrawDigital(m_painter, radius - 90);/*所有形状绘画*///逐渐发光外扇形DrawCircle(m_painter, radius - 35);//动态扇形环DrawCircle_arc(m_painter, radius-40);//指针DrawPointer(m_painter, radius-130);//最外细圆圈DrawCircle_line(m_painter, radius-35);//中间大圆DrawCircle_bom_big(m_painter, radius-150);//逐渐发光内圈DrawCircle_bom_shine(m_painter, radius-230);//中间小圆DrawCircle_bom_small(m_painter, radius-200);//单位DrawUnit(m_painter,radius-390);//时速DrawNum(m_painter,radius-300);
}void MainWindow::keyPressEvent(QKeyEvent *event)
{if(event->key() == Qt::Key_Space){if(direction == 0){myTimer->start(1);direction = 1;}}
}void MainWindow::keyReleaseEvent(QKeyEvent *event)
{if(event->key() == Qt::Key_Space)direction = 0;
}void MainWindow::DrawSmallScale(QPainter & painter, int radius)
{//组装点路径图(刻度)QPainterPath pointPath_small;pointPath_small.moveTo(-2, -2);pointPath_small.lineTo(2, -2);pointPath_small.lineTo(2, 8);pointPath_small.lineTo(-2, 8);QPainterPath pointPath_big;pointPath_big.moveTo(-2, -2);pointPath_big.lineTo(2, -2);pointPath_big.lineTo(2, 20);pointPath_big.lineTo(-2, 20);//绘制61个小点for(int i = 0; i < 121; i += 2){QPointF point(0, 0);painter.save();point.setX(radius* qCos(((210-i*2)*M_PI)/180));point.setY(radius* qSin(((-210+i*2)*M_PI)/180));painter.translate(point.x(), point.y());painter.rotate(-120+i*2);if(i<80){painter.setBrush(QColor(0, 0, 0));}if(i>=80){painter.setBrush(QColor(235, 70, 70));}if(i%5 == 0){painter.drawPath(pointPath_big);//绘画大刻度}else{painter.drawPath(pointPath_small);//绘画小刻度}painter.restore();}
}void MainWindow::DrawDigital(QPainter &painter, int radius)
{//设置画笔,画笔默认NOPENpainter.setPen(QColor(0, 0, 0));QFont font;font.setFamily("Arical");font.setPointSize(15);font.setBold(true);painter.setFont(font);for(int i=0;i<13;++i){QPointF point(0, 0);painter.save();point.setX(radius* qCos(((210-i*20)*M_PI)/180));point.setY(radius* qSin(((210-i*20)*M_PI)/180));painter.translate(point.x(), -point.y());painter.rotate(-120+i*20);painter.drawText(-25, 0, 50, 20, Qt::AlignCenter, QString::number(i*20));painter.restore();}//还原画笔painter.setPen(Qt::NoPen);
}void MainWindow::DrawCircle(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath outRing;QPainterPath inRing;outRing.moveTo(0,0);inRing.moveTo(0,0);outRing.arcTo(-radius, -radius, 2*radius, 2*radius, -30, 240);inRing.addEllipse(-radius+50, -radius+50, 2*(radius-50), 2*(radius-50));outRing.closeSubpath();//设置渐变色QRadialGradient radialGradient(0,0,radius,0,0);radialGradient.setColorAt(1, QColor(0,82,199));radialGradient.setColorAt(0.92, Qt::transparent);//设置画刷painter.setBrush(radialGradient);//大圆减小圆painter.drawPath(outRing.subtracted(inRing));//恢复painter.restore();
}void MainWindow::DrawCircle_arc(QPainter &painter, int radius)
{QRect rect(-radius, -radius, 2*radius, 2*radius);QConicalGradient Conical(0,0,-70);Conical.setColorAt(0.1, QColor(255,88,127,200));//红色Conical.setColorAt(0.5, QColor(53,179,251,150));//蓝色painter.setBrush(Conical);painter.drawPie(rect, 210*16, -(degRotate)*16);
}void MainWindow::DrawPointer(QPainter &painter, int radius)
{//组装点路径图QPainterPath pointPath;pointPath.moveTo(10,0);pointPath.lineTo(1,-radius);pointPath.lineTo(-1,-radius);pointPath.lineTo(-10,0);pointPath.arcTo(-10,0,20,20,180,180);QPainterPath inRing;inRing.addEllipse(-5,-5,10,10);painter.save();//计算并选择绘图对象坐标painter.rotate(degRotate-120);painter.setBrush(QColor(255,0,0));painter.drawPath(pointPath.subtracted(inRing));painter.restore();
}void MainWindow::DrawCircle_line(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath outRing;QPainterPath inRing;outRing.moveTo(0,0);inRing.moveTo(0,0);outRing.arcTo(-radius,-radius,2*radius,2*radius,-30,240);inRing.addEllipse(-radius+2,-radius+2,2*(radius-2),2*(radius-2));outRing.closeSubpath();//设置画刷painter.setBrush(QColor(5,228,255));//大圆减小圆painter.drawPath(outRing.subtracted(inRing));painter.restore();
}void MainWindow::DrawCircle_bom_big(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath inRing;inRing.moveTo(0,0);inRing.addEllipse(-radius+50,-radius+50,2*(radius-50),2*(radius-50));//设置画刷painter.setBrush(QColor(10,20,30));painter.drawPath(inRing);painter.restore();
}void MainWindow::DrawCircle_bom_shine(QPainter &painter, int radius)
{//保存绘图对象painter.save();//渐变色QRadialGradient radialGradient(0,0,radius,0,0);radialGradient.setColorAt(0.5,QColor(10,68,185,150));radialGradient.setColorAt(1.0,Qt::transparent);painter.setBrush(QBrush(radialGradient));painter.drawRect(-radius,-radius,2*radius,2*radius);painter.restore();
}void MainWindow::DrawCircle_bom_small(QPainter &painter, int radius)
{//保存绘图对象painter.save();//计算大小圆路径QPainterPath inRing;inRing.moveTo(0,0);inRing.addEllipse(-radius+50,-radius+50,2*(radius-50),2*(radius-50));//设置画刷painter.setBrush(QColor(10,20,30));painter.drawPath(inRing);painter.restore();
}void MainWindow::DrawUnit(QPainter &painter, int radius)
{//保存绘图对象painter.save();//设置笔painter.setPen(QColor(255,255,255));//设置字体QFont font;font.setFamily("Arial");font.setPointSize(16);font.setBold(true);painter.setFont(font);//画文字painter.drawText(-50,-radius,100,20,Qt::AlignCenter,QString("km/h"));painter.setPen(QColor(0,0,0));painter.drawText(-60,-radius+130,120,40,Qt::AlignCenter,QString("当前车速"));painter.setPen(QColor(0,0,0,50));painter.drawText(-120,-radius+280,250,40,Qt::AlignCenter,QString("-请按space键加速-"));painter.restore();
}void MainWindow::DrawNum(QPainter &painter, int radius)
{//保存绘图对象painter.save();//设置笔painter.setPen(QColor(255,255,255));//设置字体QFont font;font.setFamily("Arial");font.setPointSize(45);painter.setFont(font);//写文字painter.drawText(-75,-radius-20,150,100,Qt::AlignCenter,QString::number(degRotate));painter.restore();
}void MainWindow::slot_seed_changed()
{if(direction == 1)//加速{degRotate++;if(degRotate > 240){degRotate = 240;}}else if(direction == 0)//减速{degRotate--;if(degRotate<0){degRotate = 0;myTimer->stop();}}update();//刷新画面
}

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

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

相关文章

QT自定义标题栏窗口其一:实现拖动及可拉伸效果

1、效果 2、核心代码 #include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(paren

前端新手小白的Vue3入坑指南

昨天有同学说想暑假在家学一学Vue3&#xff0c;问我有没有什么好的文档&#xff0c;我给他找了一些&#xff0c;然后顺带着&#xff0c;自己也写一篇吧&#xff0c;希望可以给新手小白们一些指引&#xff0c;Vue3欢迎你。 目录 1 项目安装 1.1 初始化项目 1.2 安装初始化依…

redis哨兵模式下业务代码连接实现

目录 一&#xff1a;背景 二&#xff1a;实现过程 三&#xff1a;总结 一&#xff1a;背景 在哨兵模式下&#xff0c;真实的redis服务地址由一个固定ip转变为可以变化的ip,这样我们业务代码在连接redis的时候&#xff0c;就需要判断哪个主redis服务地址&#xff0c;哪个是从…

火绒安全删除explorer.exe文件造成windows系统异常的问题

问题 过程是这样的&#xff0c;电脑在使用过程中突然就变成了黑色的&#xff0c;任务栏、桌面等都消失了&#xff0c;只有部分程序的窗口。具体如下&#xff1a; 因为&#xff0c;在变化的时候&#xff0c;我有瞟到一眼有个火绒的气泡消息&#xff0c;就感觉是火绒错误的删除…

适用于Mac的免费外置硬盘数据恢复软件

“我有一个 1 TB 的外置硬盘&#xff0c;它被意外格式化了。我尝试从中恢复丢失的数据。我把它连接到我的Mac&#xff0c;但里面什么也没找到。我正在寻找适用于Mac的免费外置硬盘数据恢复软件&#xff0c;例如奇客数据恢复Mac版或其他Mac数据恢复免费软件来扫描它并恢复数据。…

如何有效地进行机台数据管理,让数据发挥更大的价值?

机台数据管理是一个涉及收集、存储、分析和保护与机台&#xff08;可能是机械设备、生产线设备、医疗设备等&#xff09;相关数据的过程。通常包括以下几个方面&#xff1a; 1.数据收集&#xff1a;使用传感器和数据采集系统来收集机台的性能数据&#xff0c;如温度、压力、速…

Python轻松设置Excel单元格数字显示格式

Excel作为强大的数据处理与分析工具&#xff0c;不仅能够存储大量数据&#xff0c;还支持复杂的数据处理与可视化功能。而如何恰当地展示Excel表格中的数据是Excel文件制作的关键之一。这便涉及到Excel单元格数字格式的设置。数字格式不仅关乎数据的美学呈现&#xff0c;如货币…

【Sa-Token|4】Sa-Token微服务项目应用

若微服务数量多&#xff0c;如果每个服务都改动&#xff0c;工作量大&#xff0c;则可以只在网关和用户中心进行改动&#xff0c;也是可以实现单点登录的。 这种方式可以通过在网关服务中生成和验证 Sa-Token&#xff0c;并将其与现有的 Token关联存储在 Redis 中。用户中心提供…

arsetryhtehrwgefwadasdadasd

驱动项目 https://github.com/wqreytuk/article/blob/main/agsdygasidgasuidgoGx64_ASM_Kernel_Mode-main.7z 48b91400000080f7ffff48b8bd427ae5d594bfd6488b0948f7e148b8cdcccccccccccccc48c1ea1748f7e24c8bea49c1ed02 直接在windbg中把执行内存修改为上面这一串字节序列&am…

Java开发环境配置

一、JDK 下载JDK&#xff1a;Java Downloads | Oracle 配置环境变量&#xff1a;09、Java入门&#xff1a;Path、JAVA_HOME环境变量配置_哔哩哔哩_bilibili 二、IDEA 下载IDEA&#xff1a; Download IntelliJ IDEA – The Leading Java and Kotlin IDE (jetbrains.com) 建…

【Sa-Token|3】Sa-Token集成到现有微服务详细介绍

一、系统架构调整 用户中心&#xff1a;保持现有的用户登录、注册接口不变。多个项目&#xff1a;前后端分离&#xff0c;保持现有逻辑不变。网关服务&#xff1a;新增或配置网关服务&#xff0c;处理所有请求并进行 Token 校验和转发。统一 Token 管理&#xff1a;通过 Sa-Tok…

Kafka多维度调优

优化金字塔 应用程序层面 框架层面&#xff08;Broker层面&#xff09; JVM层面 操作系统层面 应用程序层面&#xff1a;应当优化业务代码合理使用kafka&#xff0c;合理规划主题&#xff0c;合理规划分区&#xff0c;合理设计数据结构&#xff1b; 框架层面&#xff1a;在不…

俄罗斯塔斯社TASS 媒体投放报道:海外媒体发稿扭转战局

大舍传媒 -作为一家颇具影响力的媒体机构&#xff0c;一直致力于传播客观、真实的新闻信息。最近&#xff0c;大舍传媒注意到了塔斯社TASS的报道&#xff0c;了解到海外媒体发稿对于扭转国内局势有着重要的影响。本文将就此话题进行分析探讨。 塔斯社TASS&#xff1a;俄语区最…

transformer之位置编码

由于 Transformer 模型中自注意力模块具有置换不变性,因此仅使用注意力机制无法捕捉序列中的顺序关系,从而退化为“词袋模型”。为了解决这一问题,需要引入位置编码(Position Embedding, PE)对于序列信息进行精确建模,从而将绝对或相对位置信息整合到模型中。 什么是位置…

Excel 组内多列明细拼成一行

某表格有 1 个分组列和 2 个明细列。 ABC1ObjectNameInfo212AGggtz44456312AGggtr99987412AKkkio66543512ABbvgf66643612AVvvhg888765712AFffgt8786FGggtf23232596FXxxde44321610P23Cccvb554328711P23Vvvbj565656412P23Sswec898976413P23Llloiu343432 现在要把组内的多列明细…

在ubuntu中恢复误删除的文件

1、安装 TestDisk 在 Ubuntu 上&#xff0c;可以使用以下命令安装 TestDisk&#xff1a; sudo apt-get install testdisk2、查询你删除的文件所在那个分区 #查询分区 df -h #我这里是/dev/sda2 #也可以使用下面命令查看具体哪个分区 lsblk3、查询该分区是什么系统类型 sudo …

数据库系统概论(个人笔记)(第四部分)

数据库系统概论&#xff08;个人笔记&#xff09; 文章目录 数据库系统概论&#xff08;个人笔记&#xff09;4、中间的SQL4.1 连接表达式4.2 视图4.3 事务4.4 完整性约束4.5 SQL数据类型和模式4.6 SQL中的索引定义4.7 授权 4、中间的SQL 4.1 连接表达式 Join Expressions Join…

计算机网络:网络层 - 路由选择协议

计算机网络&#xff1a;网络层 - 路由选择协议 路由器的结构路由选择协议概述自治系统 AS内部网关协议路由信息协议 RIP距离向量算法RIP报文格式收敛问题 开放最短路径优先 OSPF基本工作原理自治系统分区 外部网关协议BGP-4 路由器的结构 如图所示&#xff0c;路由器被分为路由…

PostgreSQL的学习心得和知识总结(一百四十五)|深入理解PostgreSQL数据库之ShowTransactionState的使用及父子事务有限状态机

目录结构 注&#xff1a;提前言明 本文借鉴了以下博主、书籍或网站的内容&#xff0c;其列表如下&#xff1a; 1、参考书籍&#xff1a;《PostgreSQL数据库内核分析》 2、参考书籍&#xff1a;《数据库事务处理的艺术&#xff1a;事务管理与并发控制》 3、PostgreSQL数据库仓库…

mac怎么压缩pdf文件,苹果电脑怎么压缩pdf文件大小

在当今数字化时代&#xff0c;PDF文件已成为广泛使用的文档格式之一。然而&#xff0c;PDF 文件可能会因其包含的图像、图形和其他元素而导致文件较大&#xff0c;这可能会影响文件的传输、存储和共享。因此&#xff0c;对 PDF 文件进行压缩以减小其文件大小是很有必要的。今天…