当前位置: 首页 > news >正文

QT的Model-View实现大批量数据展示

一、完整源代码

1.项目结构

2.各文件代码展示

define.h

#pragma once
#include <QVector>//学生信息
typedef struct _STUDENT {QString name;   //姓名int score1;     //语文成绩int score2;     //数学成绩int score3;     //外语成绩_STUDENT(){name = "";score1 = score2 = score3 = 0;}
}STUDENT, *PSTUDENT;//班级信息
typedef struct _CLASS {QString name;   //班级QVector<STUDENT*> students;_CLASS(){name = "";}
}CLASS;

mainwindow.h

#pragma once#include <QtWidgets/QWidget>
#include "ui_mainwindow.h"
#include "define.h"class TreeModel;
class TreeItem;class MainWindow : public QWidget
{Q_OBJECTpublic:MainWindow(QWidget *parent = Q_NULLPTR);private slots:void on_btn1_clicked(); //QStandardItemModelvoid on_btn2_clicked(); //自定义modelvoid SlotItemSelect(const QModelIndex &modelIndex);void SlotAddItem();void SlotRightMenu(const QPoint &pos);void SlotTreeMenuDelete();private:Ui::MainWindowClass *ui;QVector<CLASS*> mClasses;   //模拟数据TreeModel *model;
};

mainwindow.cpp

#include "mainwindow.h"
#include "TreeItem.h"
#include "TreeModel.h"#include <QMenu>
#include <QTreeView>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QItemSelectionModel>MainWindow::MainWindow(QWidget *parent): QWidget(parent), ui(new Ui::MainWindowClass())
{ui->setupUi(this);//初始化模拟数据:学生成绩//10个班级、每个班级10000个学生,共10W行记录int nClass = 10;int nStudent = 100000;for (int i = 0; i < nClass; i++){CLASS* c = new CLASS;c->name = QString("class%1").arg(i);for (int j = 0; j < nStudent; j++){STUDENT* s = new STUDENT;s->name = QString("name%1").arg(j);s->score1 = s->score2 = s->score3 = (j % 10) * 10;c->students.append(s);}mClasses.append(c);}connect(ui->btn1, &QPushButton::clicked, this, &MainWindow::on_btn1_clicked);connect(ui->btn2, &QPushButton::clicked, this, &MainWindow::on_btn2_clicked);connect(ui->treeView, &QTreeView::clicked, this, &MainWindow::SlotItemSelect);connect(ui->pushButton, &QPushButton::clicked, this, &MainWindow::SlotAddItem);connect(ui->treeView, &QTreeView::customContextMenuRequested, this, &MainWindow::SlotRightMenu);ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
}void MainWindow::on_btn1_clicked()
{//1,QTreeView常用设置项QTreeView* t = ui->treeView;//    t->setEditTriggers(QTreeView::NoEditTriggers);			//单元格不能编辑t->setSelectionBehavior(QTreeView::SelectRows);			//一次选中整行t->setSelectionMode(QTreeView::SingleSelection);        //单选,配合上面的整行就是一次选单行
//    t->setAlternatingRowColors(true);                       //每间隔一行颜色不一样,当有qss时该属性无效t->setFocusPolicy(Qt::NoFocus);                         //去掉鼠标移到单元格上时的虚线框//2,列头相关设置t->header()->setHighlightSections(true);                //列头点击时字体变粗,去掉该效果t->header()->setDefaultAlignment(Qt::AlignCenter);      //列头文字默认居中对齐t->header()->setDefaultSectionSize(100);                //默认列宽100t->header()->setStretchLastSection(true);               //最后一列自适应宽度t->header()->setSortIndicator(0, Qt::AscendingOrder);    //按第1列升序排序//3,构造ModelQStringList headers;headers << QStringLiteral("班级/姓名")<< QStringLiteral("语文")<< QStringLiteral("数学")<< QStringLiteral("外语")<< QStringLiteral("总分")<< QStringLiteral("平均分")<< QStringLiteral("是否合格")<< QStringLiteral("是否评优");QStandardItemModel* model = new QStandardItemModel(ui->treeView);model->setHorizontalHeaderLabels(headers);foreach(CLASS* c, mClasses){QStandardItem *pItemClass = new QStandardItem(c->name);model->appendRow(pItemClass);foreach(STUDENT* s, c->students){//二级节点:学生信息int score1 = s->score1;int score2 = s->score2;int score3 = s->score3;int nTotal = score1 + score2 + score3;int nAverage = nTotal / 3;bool bPass = true;if (score1 < 60 || score2 < 60 || score3 < 60){//任意一门课不合格则不合格bPass = false;}bool bGood = false;if (score1 >= 90 && score2 >= 90 && score3 >= 90){//每门课都达到90分以上评优bGood = true;}QList<QStandardItem*> items;QStandardItem* item0 = new QStandardItem(s->name);QStandardItem* item1 = new QStandardItem(QString::number(score1));QStandardItem* item2 = new QStandardItem(QString::number(score2));QStandardItem* item3 = new QStandardItem(QString::number(score3));QStandardItem* item4 = new QStandardItem(QString::number(nTotal));QStandardItem* item5 = new QStandardItem(QString::number(nAverage));QStandardItem* item6 = new QStandardItem(bPass ? QStringLiteral("合格") : QStringLiteral("不合格"));QStandardItem* item7 = new QStandardItem(bGood ? QStringLiteral("优秀") : QStringLiteral("-"));items << item0 << item1 << item2 << item3 << item4 << item5 << item6 << item7;pItemClass->appendRow(items);}}t->setModel(model);
}void MainWindow::on_btn2_clicked()
{//1,QTreeView常用设置项QTreeView* t = ui->treeView;//    t->setEditTriggers(QTreeView::NoEditTriggers);			//单元格不能编辑t->setSelectionBehavior(QTreeView::SelectRows);			//一次选中整行t->setSelectionMode(QTreeView::SingleSelection);        //单选,配合上面的整行就是一次选单行
//    t->setAlternatingRowColors(true);                       //每间隔一行颜色不一样,当有qss时该属性无效t->setFocusPolicy(Qt::NoFocus);                         //去掉鼠标移到单元格上时的虚线框//2,列头相关设置t->header()->setHighlightSections(true);                //列头点击时字体变粗,去掉该效果t->header()->setDefaultAlignment(Qt::AlignCenter);      //列头文字默认居中对齐t->header()->setDefaultSectionSize(100);                //默认列宽100t->header()->setStretchLastSection(true);               //最后一列自适应宽度t->header()->setSortIndicator(0, Qt::AscendingOrder);    //按第1列升序排序//3,构造ModelQStringList headers;headers << QStringLiteral("班级/姓名")<< QStringLiteral("语文")<< QStringLiteral("数学")<< QStringLiteral("外语")<< QStringLiteral("总分")<< QStringLiteral("平均分")<< QStringLiteral("是否合格")<< QStringLiteral("是否评优");model = new TreeModel(headers, ui->treeView);TreeItem *pRootItem = model->root();foreach(CLASS* c, mClasses){TreeItem *pClass = new TreeItem(pRootItem);pClass->setLevel(1);pClass->setPtr(c);pRootItem->appendChild(pClass);foreach(STUDENT* s, c->students){TreeItem* itemStudent = new TreeItem(pClass);itemStudent->setLevel(2);   //设为一级节点,供显示时判断节点层级来转换数据指针类型itemStudent->setPtr(s);     //保存STUDENT* s为其数据指针,显示时从STUDENT*取内容显示pClass->appendChild(itemStudent);}}t->setModel(model);
}void MainWindow::SlotItemSelect(const QModelIndex &modelIndex)
{TreeItem *pItem = static_cast<TreeItem*>(modelIndex.internalPointer());QString strText = QString::number(pItem->level());strText += "\n" + QString::number(pItem->row());ui->plainTextEdit->setPlainText(strText);
}void MainWindow::SlotAddItem()
{QItemSelectionModel *pSelectionModel = ui->treeView->selectionModel();if (pSelectionModel->hasSelection()) {// 获取选中的索引列表QModelIndexList selectedIndexes = pSelectionModel->selectedIndexes();// 一般情况下,QTreeView 是单选,所以可以直接获取第一个选中的索引QModelIndex selectedIndex = selectedIndexes.first();// 如果需要处理特定列的数据,可以通过 QModelIndex 访问模型中的数据//QVariant data = selectedIndex.data(Qt::DisplayRole);TreeItem *pItem = static_cast<TreeItem*>(selectedIndex.internalPointer());TreeItem *pParentItem = pItem->parentItem();STUDENT* s = new STUDENT;s->name = QString("name10086");s->score1 = s->score2 = s->score3 = 10086;TreeItem *pAddItem = new TreeItem(pParentItem);pAddItem->setPtr(s);pAddItem->setLevel(2);pParentItem->appendChild(pAddItem);ui->treeView->setModel(model);// 方法1,递归方法//QModelIndex pParentIndex = model->indexOfItem(pParentItem);// 方法2,通过createIndexQModelIndex pParentIndex = model->indexFromItem(pParentItem);ui->treeView->collapse(pParentIndex);ui->treeView->expand(pParentIndex);}
}void MainWindow::SlotRightMenu(const QPoint &pos)
{//创建右键菜单QMenu menu;//添加actionQAction *actionDelete = new QAction(QStringLiteral("删除"));menu.addAction(actionDelete);connect(actionDelete, &QAction::triggered, this, &MainWindow::SlotTreeMenuDelete);menu.exec(ui->treeView->viewport()->mapToGlobal(pos));
}void MainWindow::SlotTreeMenuDelete()
{QItemSelectionModel *pSelectionModel = ui->treeView->selectionModel();if (pSelectionModel->hasSelection()){QModelIndexList selectedIndexes = pSelectionModel->selectedIndexes();QModelIndex selectedIndex = selectedIndexes.first();TreeItem *pItem = static_cast<TreeItem*>(selectedIndex.internalPointer());TreeItem *pParentItem = pItem->parentItem();pParentItem->removeChild(pItem->row());for (int i = 0; i < pParentItem->getChildList().size(); i++){TreeItem *pItemTemp = pParentItem->getChildList().at(i);pItemTemp->setRow(i);}QModelIndex pParentIndex = model->indexFromItem(pParentItem);ui->treeView->collapse(pParentIndex);ui->treeView->expand(pParentIndex);}
}

TreeItem.h

#pragma once
#include <QVariant>
#include <QList>
class TreeItem
{
public:explicit TreeItem(TreeItem *parentItem = nullptr);~TreeItem();int childCount() const;                 //子节点计数int row() const;                        //获取该节点是父节点的第几个子节点void appendChild(TreeItem *item);void removeChild(int index);QList<TreeItem*> getChildList();TreeItem *parentItem();                 //获取父节点指针TreeItem *child(int row);               //获取第row个子节点指针//核心函数:获取节点第column列的数据QVariant data(int column) const;//设置、获取节点是几级节点(就是树的层级)int level() { return m_nLevel; }void setLevel(int level) { m_nLevel = level; }//设置、获取节点存的数据指针void setPtr(void* p) { m_pPtr = p; }void* ptr() { return m_pPtr; }//保存该节点是其父节点的第几个子节点,查询优化所用void setRow(int row) {m_nRow = row;}private:TreeItem *m_pParentItem;QList<TreeItem*> m_listChildItems;int m_nLevel;void *m_pPtr;int m_nRow;};

TreeItem.cpp

#include "TreeItem.h"
#include "define.h"
TreeItem::TreeItem(TreeItem *parentItem /*= nullptr*/)
{m_pParentItem = parentItem;
}TreeItem::~TreeItem()
{}int TreeItem::childCount() const
{return m_listChildItems.count();
}int TreeItem::row() const
{return m_nRow;
}void TreeItem::appendChild(TreeItem *item)
{item->setRow(m_listChildItems.size());   //item存自己是第几个,可以优化效率m_listChildItems.append(item);
}void TreeItem::removeChild(int index)
{delete m_listChildItems.takeAt(index); // 删除并释放元素的内存
}QList<TreeItem*> TreeItem::getChildList()
{return m_listChildItems;
}TreeItem * TreeItem::parentItem()
{return m_pParentItem;
}TreeItem * TreeItem::child(int row)
{return m_listChildItems.value(row);
}QVariant TreeItem::data(int column) const
{if (m_nLevel == 1){//一级节点,班级if (column == 0){CLASS* c = (CLASS*)m_pPtr;return c->name;}}else if (m_nLevel == 2){//二级节点学生信息STUDENT* s = (STUDENT*)m_pPtr;switch (column){case 0: return s->name;case 1: return QString::number(s->score1);case 2: return QString::number(s->score2);case 3: return QString::number(s->score3);case 4: return QString::number(s->score1 + s->score2 + s->score3);case 5: return QString::number((s->score1 + s->score2 + s->score3) / 3);case 6:{if (s->score1 < 60 || s->score2 < 60 || s->score3 < 60){//任意一门课不合格则不合格return QStringLiteral("不合格");}else{return QStringLiteral("合格");}}case 7:{if (s->score1 >= 90 && s->score2 >= 90 && s->score3 >= 90){//每门课都达到90分以上评优return QStringLiteral("优秀");}else{return QStringLiteral("-");}}default:return QVariant();}}return QVariant();
}

TreeModel.h

#pragma once
#include "TreeItem.h"
#include <QAbstractItemModel>
class TreeModel : public QAbstractItemModel
{Q_OBJECT
public:explicit TreeModel(QStringList headers,QObject *parent = nullptr);~TreeModel();//以下为自定义model需要实现的一些虚函数,将会被Qt在查询model数据时调用//headerData: 获取表头第section列的数据//data: 核心函数,获取某个索引index的元素的各种数据//      role决定获取哪种数据,常用有下面几种://      DisplayRole(默认):就是界面显示的文本数据//      TextAlignmentRole:就是元素的文本对齐属性//      TextColorRole、BackgroundRole:分别指文本颜色、单元格背景色//flags: 获取index的一些标志,一般不怎么改//index: Qt向你的model请求一个索引为parent的节点下面的row行column列子节点的元素,在本函数里你需要返回该元素的正确索引//parent:获取指定元素的父元素//rowCount: 获取指定元素的子节点个数(下一级行数)//columnCount: 获取指定元素的列数Qt::ItemFlags flags(const QModelIndex &index) const override;QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;QModelIndex parent(const QModelIndex &child) const override;int rowCount(const QModelIndex &parent = QModelIndex()) const override;int columnCount(const QModelIndex &parent = QModelIndex()) const override;public:TreeItem *itemFromIndex(const QModelIndex &index) const;QModelIndex indexFromItem(const TreeItem *item) const;QModelIndex indexOfItem(TreeItem *item) const;QModelIndex recursiveIndexSearch(TreeItem *currentItem, TreeItem *targetItem) const;TreeItem *root();private:QStringList m_listHeaders;TreeItem *m_pRootItem;
};

TreeModel.cpp

#include "TreeModel.h"TreeModel::TreeModel(QStringList headers, QObject *parent /*= nullptr*/):QAbstractItemModel(parent)
{m_listHeaders = headers;m_pRootItem = new TreeItem;
}TreeModel::~TreeModel()
{}Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
{if (!index.isValid()){return 0;}return QAbstractItemModel::flags(index);
}// 返回表头第section列的数据
QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole*/) const
{if (orientation == Qt::Horizontal){if (role == Qt::DisplayRole){return m_listHeaders.at(section);}}return QVariant();
}QVariant TreeModel::data(const QModelIndex &index, int role /*= Qt::DisplayRole*/) const
{if (!index.isValid()){return QVariant();}TreeItem *item = static_cast<TreeItem*>(index.internalPointer());if (role == Qt::DisplayRole){return item->data(index.column());}return QVariant();
}QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent /*= QModelIndex()*/) const
{if (!hasIndex(row, column, parent))return QModelIndex();TreeItem *parentItem;if (!parent.isValid()){parentItem = m_pRootItem;}else{parentItem = static_cast<TreeItem *>(parent.internalPointer());}TreeItem *pChildItem = parentItem->child(row);if (pChildItem){return createIndex(row,column,pChildItem);}else{return QModelIndex();}
}QModelIndex TreeModel::parent(const QModelIndex &child) const
{if (!child.isValid())return QModelIndex();TreeItem *childItem = static_cast<TreeItem*>(child.internalPointer());TreeItem *parentItem = childItem->parentItem();if (parentItem == m_pRootItem)return QModelIndex();return createIndex(parentItem->row(), 0, parentItem);
}int TreeModel::rowCount(const QModelIndex &parent /*= QModelIndex()*/) const
{TreeItem *parentItem;if (parent.column() > 0)return 0;if (!parent.isValid())parentItem = m_pRootItem;elseparentItem = static_cast<TreeItem*>(parent.internalPointer());return parentItem->childCount();
}int TreeModel::columnCount(const QModelIndex &parent /*= QModelIndex()*/) const
{return m_listHeaders.size();;
}TreeItem * TreeModel::itemFromIndex(const QModelIndex &index) const
{if (!index.isValid())return nullptr;TreeItem *item = static_cast<TreeItem *>(index.internalPointer());return item;
}QModelIndex TreeModel::indexFromItem(const TreeItem *item) const
{TreeItem *pItem = const_cast<TreeItem *>(item);if (pItem->parentItem() == m_pRootItem){return createIndex(pItem->row(), 0, pItem);}return QModelIndex();
}QModelIndex TreeModel::indexOfItem(TreeItem *item) const
{// 如果模型是树形结构,可以递归遍历查找return recursiveIndexSearch(m_pRootItem, item);
}QModelIndex TreeModel::recursiveIndexSearch(TreeItem *currentItem, TreeItem *targetItem) const
{if (currentItem == targetItem) {// 如果找到了目标项,返回其索引return createIndex(currentItem->row(), 0, currentItem);}// 递归搜索子项for (int i = 0; i < currentItem->childCount(); ++i) {QModelIndex idx = recursiveIndexSearch(currentItem->child(i), targetItem);if (idx.isValid()) {return idx;}}return QModelIndex();
}TreeItem * TreeModel::root()
{return m_pRootItem;
}
3.界面


二、重要部分代码解释

1.TreeModel.cpp

在TreeMode中,最重要的是data()函数,该函数决定数据是否能够直接在View层进行显示。该接口中的QModelIndex是树中哪个结点下哪一行哪一列的索引(Model-View主要依赖于QModelIndex来取数据显示)。QModelIndex详解看:QT模型视图MVC系列教程(2)-模型数据索引QModelIndex详解-CSDN博客

QVariant TreeModel::data(const QModelIndex &index, int role /*= Qt::DisplayRole*/) const
{if (!index.isValid()){return QVariant();}TreeItem *item = static_cast<TreeItem*>(index.internalPointer());if (role == Qt::DisplayRole){return item->data(index.column());}return QVariant();
}
2.TreeItem.cpp

TreeItem是自定义的一个item类,也就是树中显示的每一行数据在Model中的存储。View层会通过data函数来取要显示的数据。比如TreeModel::data中的return item->data(index.column());

QVariant TreeItem::data(int column) const
{if (m_nLevel == 1){//一级节点,班级if (column == 0){CLASS* c = (CLASS*)m_pPtr;return c->name;}}else if (m_nLevel == 2){//二级节点学生信息STUDENT* s = (STUDENT*)m_pPtr;switch (column){case 0: return s->name;case 1: return QString::number(s->score1);case 2: return QString::number(s->score2);case 3: return QString::number(s->score3);case 4: return QString::number(s->score1 + s->score2 + s->score3);case 5: return QString::number((s->score1 + s->score2 + s->score3) / 3);case 6:{if (s->score1 < 60 || s->score2 < 60 || s->score3 < 60){//任意一门课不合格则不合格return QStringLiteral("不合格");}else{return QStringLiteral("合格");}}case 7:{if (s->score1 >= 90 && s->score2 >= 90 && s->score3 >= 90){//每门课都达到90分以上评优return QStringLiteral("优秀");}else{return QStringLiteral("-");}}default:return QVariant();}}return QVariant();
}

相关文章:

QT的Model-View实现大批量数据展示

一、完整源代码 1.项目结构 2.各文件代码展示 define.h #pragma once #include <QVector>//学生信息 typedef struct _STUDENT {QString name; //姓名int score1; //语文成绩int score2; //数学成绩int score3; //外语成绩_STUDENT(){name ""…...

2024年8月7日(mysql主从 )

回顾 主服务器 [rootmaster_mysql ~]# yum -y install rsync [rootmaster_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar [rootmaster_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz [rootmaster_mysql ~]# cp -r mysql-8.0.33-linux-glibc2.…...

接口/自动化测试 面试集合

1. apache和nginx的区别? Nginx相对Apache的优点: 轻量级&#xff0c;同样起web服务&#xff0c;比apache占用更少的内存及资源; 抗并发&#xff0c;nginx处理请求是异步非阻塞的&#xff0c;支持更多的并发连接&#xff0c;而apache则是阻塞型的&#xff0c;在高 并发下ngi…...

菜鸡勇闯第136场双周赛

菜鸡鼓足了勇气报名了力扣双周赛&#xff08;后来复盘才知道双周赛更难一点&#xff0c;我真是头铁。。&#xff09; 没想到还拿了个竞赛名次哈哈哈哈哈还在前50%&#xff0c;小力它真的&#xff0c;我哭死 为什么我本科被高数老师忽悠&#xff0c;去打了两年数模o(≧口≦)o 每…...

趋动科技陈飞:从小模型到大模型,AI时代下的数据中心建设

自AI大模型横空出世&#xff0c;不断推动着AI从学术界到产业界向大众破圈&#xff0c;新的时代正在来临。11月15-16日&#xff0c;由CDCC主办的“2023第11届数据中心标准大会”在北京国家会议中心盛大开幕。 本届大会的主题围绕“AI时代 重塑未来”&#xff0c;聚焦数据中心领…...

yolo v8 + flask部署到云服务器,以及问题记录

环境安装 1、运行项目报错&#xff1a;no python application found, check your startup logs for errors 在云服务器pytorch版本安装错了&#xff0c;安装了GPU版本&#xff0c;需要安装CPU版本 # CPU only 使用下面这段代码避免出现第二个错误 pip install torch2.3.1 to…...

【科研必备插件】easyscholar如何使文章显示期刊影响因子与分区等级

简要介绍 EasyScholar 是一个微软 Edge 浏览器的扩展程序&#xff0c;可以显示会议、期刊等级。可支持在各大论文搜索网站&#xff0c;显示各种期刊、会议等级排名 要想你的知网页面如下图所示&#xff0c;快来获取安装&#xff0c;快速科研有方法 插件安装教程 ①打开浏览器…...

UE5 UrlEncode转换

调用接口时用到了 UFUNCTION(BlueprintPure, Category "FuncLib", meta (Keywords "URL1"))static FString StringToURLEncode(const FString& str1);FString UBasicFuncLib::StringToURLEncode(const FString& str1){return FGenericPlatformH…...

【QML】Qt.rgba()的正确使用方法

1. 问题 设置颜色 color: Qt.rgba(65,105,225,255) &#xff0c;应该是蓝色&#xff0c;却显示白色。 2. 正确方法 //正确代码 color: Qt.rgba(65/255, 105/255, 225/255, 255/255)...

centos7.9 docker安装

1、不要通过yum直接安装 具体原因&#xff1a; CentOS 6 因内核太旧&#xff0c;即使支持安装 docker&#xff0c;但会有各种问题&#xff0c;不建议安装CentOS 7 的 extras 源虽然可以安装 docker&#xff0c;但包比较旧&#xff0c;建议从官方源或镜像源站点下载安装 docke…...

spring操作数据库

xml版 程序结构 配置文件 dbUtil-阿帕奇提供操作数据库的插件 核心类&#xff1a;QueryRunner .query() 查询 .update() 增删改 <dependencies><!-- spring --><dependency><groupId>org.springframework</groupId><artifactId>spri…...

Apache Flink中TaskManager,SubTask,TaskSlot,并行度之间的关系

Apache Flink 中Application 与 Job 一个完整的Flink Application 一般组成如下&#xff1a; Source 数据来源Transformation 数据转换处理等Sink 数据传输 Flink 中一个或者多个Operator&#xff08;算子&#xff09;组合对数据进行转换形成一个 Transformation&#xff0c;一…...

马斯克xAI新计划:人工智能模型Grok 2测试版即将发布

特斯拉CEO马斯克在X平台上表示&#xff0c;人工智能模型Grok 2测试版即将发布。Grok&#xff0c;作为xAI公司的明星大语言模型&#xff0c;其首代产品Grok 1已凭借神经演化计算与深度学习技术的深度融合&#xff0c;展现了超乎想象的学习速度与智能深度&#xff0c;赢得了业界的…...

【机器人学】6-4.六自由度机器人运动学参数辨识-机器人精度验证【附MATLAB代码】

前言 前两个章节以及完成了机器人参数辨识。 【机器人学】6-1.六自由度机器人运动学参数辨识-辨识数学模型的建立 【机器人学】6-2.六自由度机器人运动学参数辨识-优化方法求解辨识参数 这里我们认为激光测量仪测量到的数据为机器人实际到达的位置&#xff0c;而机器人理论到…...

分销商城小程序系统渠道拓展

线上卖货渠道很多&#xff0c;想要不断提高营收和新客获取&#xff0c;除了自己和工具本身努力外&#xff0c;还需要其他人的帮助来提高商城店铺的整体销量。 搭建saas商城系统网站/小程序&#xff0c;后台上货&#xff0c;设置支付、配送、营销、精美模板商城装修等内容&…...

WPF篇(14)-ProgressBar进度条+Calendar日历控件+DatePicker日期控件

ProgressBar进度条 ProgressBar进度条通常在我们执行某个任务需要花费大量时间时使用&#xff0c;这时可以采用进度条显示任务或线程的执行进度&#xff0c;以便给用户良好的使用体验。 ProgressBar类定义 public class ProgressBar : RangeBase {public static readonly De…...

链表高频题目和必备技巧

链表高频题目和必备技巧 1. 链表类题目注意点 1&#xff0c;如果笔试中空间要求不严格&#xff0c;直接使用容器来解决链表问题 2&#xff0c;如果笔试中空间要求严格、或者在面试中面试官强调空间的优化&#xff0c;需要使用额外空间复杂度**O(1)**的方法 3&#xff0c;最…...

Vue3详细介绍,正则采集器所用前端框架

Vue3 引入了一个全新的响应式系统&#xff0c;它是基于ES6的Proxy特性构建的。这个系统使得 Vue 能够更加高效地追踪数据的变化&#xff0c;并在数据发生变化时自动更新DOM。响应式系统的核心是"可观察"&#xff0c;当数据变化时&#xff0c;视图会响应这些变化并重新…...

数据集--COCO2017(快速下载)

1、数据集介绍 数据集官网&#xff1a;https://cocodataset.org/#home COCO&#xff08;Common Objects in Context&#xff09;数据集是计算机视觉领域中最广泛使用的数据集之一&#xff0c;主要用于目标检测、分割和图像标注任务。COCO 数据集由 Microsoft 发布&#xff0c…...

【管理咨询宝藏159】顶级咨询公司人力三支柱建设方案思路

阅读完整版报告内容&#xff0c;请搜索VV号“管理咨询宝藏”。 【管理咨询宝藏159】顶级咨询公司人力三支柱建设方案思路 【格式】PDF版本 【关键词】人力咨询、三支柱、人力体系 【核心观点】 - 集团总部制定全集团共享中心总体规划路径&#xff0c;组织并负责实施与推广。各…...

跨时钟域总结

跨时钟域总结 秋招学习跨时钟域 总结一下吧 异步电路 设计中有两个频率不同的时钟(也可能多个),而有数据在两组时钟之间传输 单bit跨时钟域 慢时钟域数据-> 快时钟域 方法 : 使用两个锁存器 (打两拍) 数据跨时钟域同步过程中,脉冲宽度会改变&#xff0c;不影响同步结…...

富婆和富公子都在看的负载均衡和Haproxy大全

一.负载均衡 1.1&#xff1a;什么是负载均衡 负载均衡&#xff1a; Load Balance &#xff0c;简称 LB &#xff0c;是一种服务或基于硬件设备等实现的高可用反向代理技术&#xff0c;负载均 衡将特定的业务(web 服务、网络流量等 ) 分担给指定的一个或多个后端特定的服务器或…...

VScode找python环境 (conda)

第一步 CtrlshiftP 第二步 框框里输入&#xff1a;Python:Select Interpreter...

C# Winform序列化和反序列化

在NET Framework 4.7.2中不能用Newtonsoft.Json进行序列化和反序列化&#xff0c;为解决此问题&#xff0c;采用System.Text.Json进行序列化&#xff0c;注意要添加System.Memory的引用。 1、创建测试类 using System; using System.Collections.Generic; using System.Linq; …...

crc原理概述

CRC&#xff08;循环冗余校验&#xff09;是一种错误检测技术&#xff0c;用于确保数据在传输或存储过程中没有发生变化。它通过将数据视为一个多项式&#xff0c;利用二进制除法得到一个校验码&#xff08;CRC值&#xff09;。接收方使用相同的算法验证数据和CRC值是否匹配&am…...

C++要求或禁止在堆中产生对象

有时你想这样管理某些对象&#xff0c;要让某种类型的对象能够自我销毁&#xff0c;也就是能够“delete this”。很明显这种管理方式需要此类型对象被分配在堆中。而其它一些时候你想获得一种保障&#xff1a;“不在堆中分配对象&#xff0c;从而保证某种类型的类不会发生内存泄…...

为什么阿里开发手册推荐用静态工厂方法代替构造器?

&#x1f345; 作者简介&#xff1a;哪吒&#xff0c;CSDN2021博客之星亚军&#x1f3c6;、新星计划导师✌、博客专家&#x1f4aa; &#x1f345; 哪吒多年工作总结&#xff1a;Java学习路线总结&#xff0c;搬砖工逆袭Java架构师 &#x1f345; 技术交流&#xff1a;定期更新…...

前端写法建议【让项目更加易于维护】

背景 标题前提条件&#xff1a; 没有字典接口、或其他原因&#xff0c;需要前端手动维护的情况 示例环境&#xff1a;vue2&#xff0c;其他项目同理 示例 如果项目有某种类别&#xff0c;前端和后端约定好了&#xff0c;某些情况下&#xff0c;需要前端写死时。 比如有字段…...

EasyExcel 自定义转换器、自定义导出字典映射替换、满足条件内容增加样式,完整代码+详细注释说明

虽然最之前是在其他地方看到的&#xff0c;但最终因缘巧合下找到了原文&#xff0c;还是尊重一下原作者。 参考引用了这位佬的博客&#xff0c;确实方便使用。 https://blog.csdn.net/qq_45914616/article/details/137200688?spm1001.2014.3001.5502 这是一个基于Easyexcel通过…...

C语言学习笔记 Day10(指针--中)

Day10 内容梳理&#xff1a; 目录 Chapter 7 指针 7.4 指针 & 数组 &#xff08;1&#xff09;指针操作数组元素 &#xff08;2&#xff09;指针加减运算 1&#xff09;加法 2&#xff09;减法 &#xff08;3&#xff09;指针数组 7.5 多级指针 Chapter 7 指针 …...