五、Model与View

一、Model/View结构

  • 数据:如数据库的一个数据表或者SQL查询结果,如内存中的数据类对象,或者磁盘文件结构等
  • Model:与数据通信,并作为视图组件提供数据接口
  • View:屏幕界面组件,视图从数据模型获得每个数据项的模型索引,通过数据模型索引(model index)获取数据
  • 代理:定制数据的界面或编辑方式,在标准的视图组件中,代理功能显示一个数据,当数据被编辑时,提供一个编辑器,一般时QLineEdit。

模型、视图和代理之间使用信号和槽通信

1、数据模型

  • QStringListModel:用于处理字符串列表数据的数据模型类
  • QStandardItemModel:标准的基于数据项的数据模型类,每个数据项都可以是任何数据类型
  • QFileSystemModel:计算机上文件系统的数据模型类
  • QSortFilterProxyModel:与其他数据模型结合,提供排序和过滤功能的数据类型模型类
  • QSelQueryModel:用于数据库SQL查询结果的数据模型类
  • QSqlTableModel:用于数据库的一个数据表的数据模型类
  • QSqlRelationTableModel:用于关系类型数据表的数据模型
继承关系
QAbstractItemmodelQAbstractListModelQStringListModelQAbstractProxyModelQSortFilterProxyModelQAbstractTableModelQSqlQueryModelQSlTableModelQSlRelationTableModelQStandardItemModelQFileSystemModel

2、视图组件

显示数据时,只需要调用视图类的setModel()函数
QAbstractItemViewQListViewQListWidgetQTableViewQTableWidgetQTreeViewQTreeWidgetQColumnViewQHeaderView

3、代理

代理时在视图组件上为编辑数据提供编辑器,QAbstractItemDeleget是所有代理类的基类。

二、QFileSystemModel

如Windows则资源管理器,使用QFileSystemModel童工的接口函数,可以创建目录、删除目录、重命名目录,可以获得文件名称、目录名称、文件大小等参数,还可以获取文件的详细信息。

1、实现工具

(1)创建项目,基于QMainWindow

(2)添加组件

在这里插入图片描述

(3)实现功能

#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);fileModel = new QFileSystemModel(this);fileModel->setRootPath(QDir::currentPath());ui->treeView->setModel(fileModel);ui->listView->setModel(fileModel);ui->tableView->setModel(fileModel);ui->tableView->verticalHeader()->setVisible(false);connect(ui->treeView, SIGNAL(clicked(QModelIndex)), ui->listView,SLOT(setRootIndex(QModelIndex)));connect(ui->treeView, SIGNAL(clicked(QModelIndex)), ui->tableView,SLOT(setRootIndex(QModelIndex)));}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::on_treeView_clicked(const QModelIndex &index)
{ui->labelName->setText(fileModel->fileName(index));unsigned int sz = fileModel->size(index)/1024;if(sz < 1024){ui->labelSize->setText(QString::asprintf("%d KB", sz));}else{ui->labelSize->setText(QString::asprintf("%.2f MB", (float)sz/1024));}ui->labelType->setText(fileModel->type(index));ui->labelPath->setText(fileModel->filePath(index));ui->checkBox->setChecked(fileModel->isDir(index));
}

三、QStringListModel

1、实现工具

(1)创建项目,基于Widget

(2)添加组件

在这里插入图片描述

(3)添加功能

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);theModel = new QStringListModel(this);QStringList strList;strList<<"Item1"<<"Item2"<<"Item3"<<"Item4"<<"Item5"<<"Item6";theModel->setStringList(strList);ui->listView->setModel(theModel);// 编辑:双击或者选择项单击ui->listView->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::SelectedClicked);
}Widget::~Widget()
{delete ui;
}void Widget::on_btnDisplay_clicked()
{QStringList strList = theModel->stringList();foreach (auto str, strList) {ui->plainTextEdit->appendPlainText(str);}
}void Widget::on_btnClear_clicked()
{ui->plainTextEdit->clear();
}void Widget::on_btnInitList_clicked()
{QStringList strList;strList<<"Item1"<<"Item2"<<"Item3"<<"Item4"<<"Item5"<<"Item6";theModel->setStringList(strList);
}void Widget::on_btnListClear_clicked()
{theModel->removeRows(0, theModel->rowCount());
}void Widget::on_btnListDelete_clicked()
{theModel->removeRow(ui->listView->currentIndex().row());
}void Widget::on_btnListAppend_clicked()
{theModel->insertRow(theModel->rowCount());QModelIndex index = theModel->index(theModel->rowCount()-1, 0); // 添加之后count会加一theModel->setData(index, "new Item", Qt::DisplayRole);ui->listView->setCurrentIndex(index);
}void Widget::on_btnInsert_clicked()
{theModel->insertRow(ui->listView->currentIndex().row());QModelIndex index = theModel->index(ui->listView->currentIndex().row()-1, 0); // 插入之后count会加一theModel->setData(index, "insert Item", Qt::DisplayRole);ui->listView->setCurrentIndex(index);
}void Widget::on_listView_clicked(const QModelIndex &index)
{ui->label->setText(QString::asprintf("行:%d列:%d", index.row(), index.column()));
}

四、QStandardItemModel

以项数据为基础的标准数据模型类,通常与QTableView组合成为Model/View结构,实现通用的二位数据管理功能。
  • QStandardItemModel:可以处理二维数。每一项是一个QStandardItem类的变量,用于存储项的数据、字体格式、对其方式等
  • QTableView:一个单元格显示QStandardItemModel数据模型中的一项。
  • QItemSelectionModel:跟踪视图组件的单元格选择状态的类,通过QItemSelectionModel可以获得选中的单元格的模型索引。

1、实现工具

(1)创建项目,基于QMainWindow

(2)添加图标资源文件、添加组件

在这里插入图片描述

(3)设置文本不自动换行

在这里插入图片描述

(4)设置信号与槽

#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);labCurrFile = new QLabel("当前文件", this);labCellPos = new QLabel("当前单元格", this);labCellText = new QLabel("单元格内容", this);theModel = new QStandardItemModel(10, fixedColoumCount,this);theSelection = new QItemSelectionModel(theModel);ui->tableView->setModel(theModel);ui->tableView->setSelectionModel(theSelection);labCurrFile->setMinimumWidth(200);labCellPos->setMinimumWidth(150);labCellText->setMinimumWidth(200);ui->statusBar->addWidget(labCurrFile);ui->statusBar->addWidget(labCellPos);ui->statusBar->addWidget(labCellText);connect(theSelection, SIGNAL(currentChanged(QModelIndex,QModelIndex)),this, SLOT(on_currentChanged(QModelIndex,QModelIndex)));
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::on_currentChanged(const QModelIndex &current, const QModelIndex &previous)
{Q_UNUSED(previous)if(! current.isValid()){return;}QStandardItem *item = theModel->itemFromIndex(current);labCellPos->setText(QString::asprintf("当前单元格:%d行:%d列", current.row(), current.column()));labCellText->setText("单元格内容:"+item->text());QFont font = item->font();ui->actFontBold->setChecked(font.bold());
}void MainWindow::initModelFromStringList(QStringList &fileContent)
{theModel->setRowCount(fileContent.count()-1);// 表头QString header = fileContent.at(0);QStringList headerList = header.split(",");theModel->setHorizontalHeaderLabels(headerList);// 表格数据int col;QStandardItem *item;for (int row = 1; row < fileContent.count(); ++row) {QString lineText = fileContent.at(row);QStringList colList = lineText.split(",");for (col = 0; col < fixedColoumCount-1; ++col) {item  = new QStandardItem(colList.at(col));theModel->setItem(row-1, col, item);}item = new QStandardItem(headerList.at(col));if(colList.at(col) == "1"){item->setCheckState(Qt::Checked);}else{item->setCheckState(Qt::Unchecked);}theModel->setItem(row-1, col, item);}
}#include <QFileDialog>
#include <QFile>
#include <QTextStream>
void MainWindow::on_actOpen_triggered()
{QString strCurrPath = QCoreApplication::applicationDirPath();QString strFileName = QFileDialog::getOpenFileName(this, "打开一个文件",strCurrPath, "数据文件(*.txt);;所有文件(*.*)");if(strFileName.isEmpty()){return;}QStringList fileContent;QFile file(strFileName);if(file.open(QIODevice::ReadOnly|QIODevice::Text)){QTextStream stream(&file);ui->plainTextEdit->clear();while (!stream.atEnd()) {QString str = stream.readLine();ui->plainTextEdit->appendPlainText(str);if(!str.isEmpty()){fileContent.append(str);}}file.close();this->labCurrFile->setText("当前文件:"+strFileName);initModelFromStringList(fileContent);ui->tableView->resizeColumnsToContents();ui->tableView->resizeRowsToContents();ui->actSave->setEnabled(true);ui->actAppend->setEnabled(true);ui->actDelete->setEnabled(true);ui->actInsert->setEnabled(true);}
}void MainWindow::on_actSave_triggered()
{QString strCurrPath = QCoreApplication::applicationDirPath();QString strFileName = QFileDialog::getSaveFileName(this, "另存为文件",strCurrPath, "数据文件(*.txt);;所有文件(*.*)");if(strFileName.isEmpty()){return;}QStringList fileContent;QFile file(strFileName);if(file.open(QIODevice::ReadWrite|QIODevice::Text|QIODevice::Truncate)){QTextStream stream(&file);ui->plainTextEdit->clear();QString str;int i;for (i = 0; i < theModel->columnCount()-1; ++i) {QStandardItem *item = theModel->horizontalHeaderItem(i);str += item->text()+",";}QStandardItem *item = theModel->horizontalHeaderItem(i);str += item->text();stream<<str<<"\n";ui->plainTextEdit->appendPlainText(str);int j;for (int i = 0; i < theModel->rowCount(); ++i) {str = "";for (j = 0; j < theModel->columnCount()-1; ++j) {QStandardItem *item = theModel->item(i,j);str += item->text()+",";}QStandardItem *item = theModel->item(i,j);if(item->checkState() == Qt::Checked){str += "1";}else{str += "0";}stream<<str<<"\n";ui->plainTextEdit->appendPlainText(str);}file.close();}
}void MainWindow::on_actModelData_triggered()
{ui->plainTextEdit->clear();QString str;for (int i = 0; i < theModel->columnCount(); ++i) {QStandardItem *item = theModel->horizontalHeaderItem(i);str += item->text()+",";}ui->plainTextEdit->appendPlainText(str);int j;for (int i = 0; i < theModel->rowCount(); ++i) {str = "";for (j = 0; j < theModel->columnCount()-1; ++j) {QStandardItem *item = theModel->item(i,j);str += item->text()+",";}QStandardItem *item = theModel->item(i,j);if(item->checkState() == Qt::Checked){str += "1";}else{str += "0";}ui->plainTextEdit->appendPlainText(str);}
}void MainWindow::on_actAppend_triggered()
{QList<QStandardItem*> itemList;QStandardItem *item;for (int i = 0; i < fixedColoumCount-1; ++i) {item = new QStandardItem("0");itemList << item;}QString str = theModel->headerData(theModel->columnCount()-1,Qt::Horizontal, Qt::DisplayRole).toString();item = new QStandardItem(str);item->setCheckState(Qt::Checked);itemList << item;theModel->appendRow(itemList);theSelection->clearSelection();QModelIndex index = theModel->index(theModel->rowCount()-1, 0);theSelection->setCurrentIndex(index, QItemSelectionModel::Select);
}void MainWindow::on_actInsert_triggered()
{QList<QStandardItem*> itemList;QStandardItem *item;for (int i = 0; i < fixedColoumCount-1; ++i) {item = new QStandardItem("0");itemList << item;}QString str = theModel->headerData(theModel->columnCount()-1,Qt::Horizontal, Qt::DisplayRole).toString();item = new QStandardItem(str);item->setCheckState(Qt::Checked);itemList << item;theModel->insertRow(theSelection->currentIndex().row(), itemList);theSelection->clearSelection();QModelIndex index = theModel->index(theSelection->currentIndex().row(), 0);theSelection->setCurrentIndex(index, QItemSelectionModel::Select);
}void MainWindow::on_actDelete_triggered()
{if(theSelection->currentIndex().row() ==theModel->rowCount()-1){theModel->removeRow(theSelection->currentIndex().row());}else{theModel->removeRow(theSelection->currentIndex().row());QModelIndex index = theModel->index(theSelection->currentIndex().row(), 0);theSelection->setCurrentIndex(index, QItemSelectionModel::Select);}}void MainWindow::on_actAlignLeft_triggered()
{if(!theSelection->hasSelection()){return;}QModelIndexList selectedIndexes = theSelection->selectedIndexes();for (int i = 0; i < selectedIndexes.count(); ++i) {QModelIndex index = selectedIndexes.at(i);QStandardItem *item = theModel->itemFromIndex(index);item->setTextAlignment(Qt::AlignLeft);}
}void MainWindow::on_actAlignCenter_triggered()
{if(!theSelection->hasSelection()){return;}QModelIndexList selectedIndexes = theSelection->selectedIndexes();for (int i = 0; i < selectedIndexes.count(); ++i) {QModelIndex index = selectedIndexes.at(i);QStandardItem *item = theModel->itemFromIndex(index);item->setTextAlignment(Qt::AlignCenter);}
}void MainWindow::on_actAlignRight_triggered()
{if(!theSelection->hasSelection()){return;}QModelIndexList selectedIndexes = theSelection->selectedIndexes();for (int i = 0; i < selectedIndexes.count(); ++i) {QModelIndex index = selectedIndexes.at(i);QStandardItem *item = theModel->itemFromIndex(index);item->setTextAlignment(Qt::AlignRight);}
}void MainWindow::on_actFontBold_triggered(bool checked)
{if(!theSelection->hasSelection()){return;}QModelIndexList selectedIndexes = theSelection->selectedIndexes();for (int i = 0; i < selectedIndexes.count(); ++i) {QModelIndex index = selectedIndexes.at(i);QStandardItem *item = theModel->itemFromIndex(index);QFont font  = item->font();font.setBold(checked);item->setFont(font);}
}

五、自定义代理

代理是介于Model和View之间,主要用于数据修改。
  • QAbstractItemDelegate:所有代理类的查抽象基类
  • QStyledItemDelegatte视图组件使用的缺省的代理类,可以使用当前样式表设置来绘制组件,建议使用此类
  • QItemDelegate:类似与QStyledItemDelegate,不支持使用当前样式绘制组件
QAbstractItemDelegateQStyledItemDelegateQItemDelegateQSqlRelationalDelegate
必须实现以下几个函数:
  • createEditor():创建用于编辑模型数据的widget组件
  • setEditorData():从数据模型获取数据,供widget组件进行编辑
  • setModelData():将widget上的数据更新到数据模型
  • updateEditorGeometry():用于给widget组件设置一个合适的大小

1、实现功能

在这里插入图片描述

(1)拷贝上一个项目

(2)添加类

在这里插入图片描述

(3)实现类功能

MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);labCurrFile = new QLabel("当前文件", this);labCellPos = new QLabel("当前单元格", this);labCellText = new QLabel("单元格内容", this);theModel = new QStandardItemModel(10, fixedColoumCount,this);theSelection = new QItemSelectionModel(theModel);ui->tableView->setModel(theModel);ui->tableView->setSelectionModel(theSelection);labCurrFile->setMinimumWidth(200);labCellPos->setMinimumWidth(150);labCellText->setMinimumWidth(200);ui->statusBar->addWidget(labCurrFile);ui->statusBar->addWidget(labCellPos);ui->statusBar->addWidget(labCellText);ui->tableView->setItemDelegateForColumn(0, &intSpinDelegate);   //给0列设置代理connect(theSelection, SIGNAL(currentChanged(QModelIndex,QModelIndex)),this, SLOT(on_currentChanged(QModelIndex,QModelIndex)));
}
#include "qintdelegate.h"
#include <QSpinBox>
QIntDelegate::QIntDelegate()
{}QWidget *QIntDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{Q_UNUSED(index)Q_UNUSED(option)QSpinBox *edit = new QSpinBox(parent);edit->setMinimum(0);edit->setMaximum(1000);edit->setFrame(false); //无边框return edit;
}void QIntDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{int value = index.model()->data(index, Qt::EditRole).toInt();QSpinBox *spinBox = static_cast<QSpinBox*>(editor);spinBox->setValue(value);
}void QIntDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{QSpinBox *spinBox = static_cast<QSpinBox*>(editor);spinBox->interpretText();   // 确保获得的是最新更新的数据int value = spinBox->value();model->setData(index, value, Qt::EditRole);
}void QIntDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{Q_UNUSED(index)editor->setGeometry(option.rect);
}

在这里插入图片描述

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

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

相关文章

软件工程:黑盒测试等价分类法相关知识和多实例分析

目录 一、黑盒测试和等价分类法 1. 黑盒测试 2. 等价分类法 二、黑盒测试等价分类法实例分析 1. 工厂招工年龄测试 2. 规定电话号码测试 3. 八位微机测试 4. 三角形判断测试 一、黑盒测试和等价分类法 1. 黑盒测试 黑盒测试就是根据被测试程序功能来进行测试&#xf…

Arduino快速上手esp32方案开发

一、什么是ESP32&#xff1f; ESP32是Espressif Systems推出的一款高性能、低功耗的Wi-Fi和蓝牙双模系统级芯片&#xff08;SoC&#xff09;&#xff0c;广泛应用于物联网、智能家居、可穿戴设备等领域。它基于极低功耗的Tensilica Xtensa LX6微处理器&#xff0c;并集成了丰富…

【现代密码学】笔记4--消息认证码与抗碰撞哈希函数《introduction to modern cryphtography》

【现代密码学】笔记4--消息认证码与抗碰撞哈希函数《introduction to modern cryphtography》 写在最前面4 消息认证码与抗碰撞哈希函数MAC概念回顾&#xff08;是的&#xff0c;我忘记这些缩写是什么了。。&#xff09;MAC的定义适应性CMA&#xff08;Chosen Message Attack&a…

SpringBoot教程(十五) | SpringBoot集成RabbitMq

SpringBoot教程(十五) | SpringBoot集成RabbitMq RabbitMq是我们在开发过程中经常会使用的一种消息队列。今天我们来研究研究rabbitMq的使用。 rabbitMq的官网&#xff1a; rabbitmq.com/ rabbitMq的安装这里先略过&#xff0c;因为我尝试了几次都失败了&#xff0c;后面等我…

边缘型人格障碍测试

边缘性人格障碍属于常见多发的人格障碍类型&#xff0c;在2015年美国的相关调查显示&#xff0c;边缘型人格障碍的患病率在初级医疗环境中为6%&#xff0c;在精神科住院病人中则达到20%。 边缘性人格障碍治疗难度高&#xff0c;对于个人造成的危害大。应该及早了解边缘性人格障…

软件测试|Git:fatal: refusing to merge unrelated histories错误分析与解决

问题介绍 在使用Git时&#xff0c;有时我们可能会遇到以下错误消息&#xff1a; fatal: refusing to merge unrelated histories这个错误通常发生在尝试合并两个不相关的Git仓库历史时。在本文中&#xff0c;我们将详细解释为什么会出现这个错误以及如何解决它。 问题分析 …

DataFunSummit:2023年云原生大数据峰会:核心内容与学习收获(附大会核心PPT下载)

随着数字化转型的深入推进&#xff0c;大数据技术已经成为企业获取竞争优势的关键因素之一。本次峰会汇聚了业界顶尖的大数据专家、企业领袖和技术精英&#xff0c;共同探讨云原生大数据领域的最新技术和趋势。本文将深入分析峰会的核心内容&#xff0c;并探讨参会者从中能学到…

Python字符串验证与正则表达式【第23篇—python基础】

文章目录 引言方法1&#xff1a;使用 isalpha() 方法方法2&#xff1a;使用正则表达式方法3&#xff1a;遍历字符检查应用场景示例与比较优化与扩展方法4&#xff1a;考虑空格和其他字符应用场景扩展 示例与比较优化与扩展方法4&#xff1a;考虑空格和其他字符方法5&#xff1a…

【期末不挂科-C++考前速过系列P5】大二C++实验作业-多态性(3道代码题)【解析,注释】

前言 大家好吖&#xff0c;欢迎来到 YY 滴C考前速过系列 &#xff0c;热烈欢迎&#xff01; 本章主要内容面向接触过C的老铁 主要内容含&#xff1a; 欢迎订阅 YY滴C专栏&#xff01;更多干货持续更新&#xff01;以下是传送门&#xff01; YY的《C》专栏YY的《C11》专栏YY的《…

Docker容器(二)安装与初体验wordpress

一、安装 1.1关闭SeLinux SeLinux&#xff08;Security-Enhanced Linux&#xff09;是一种基于Linux内核的安全模块&#xff0c;旨在提供更严格的访问控制和安全策略。它通过强制实施安全策略来限制系统资源的访问&#xff0c;从而保护系统免受恶意软件和未经授权的访问。 在…

2023国赛 陕西省省级二等奖得主 数学建模学习资源推荐

美国最为权威的数学建模参考书Mathematical Modeling 在前言部分对数学建模有一个比较通俗易懂的解释&#xff1a; Mathematical modeling is the link between mathematics and the rest of the world. You ask a question. You think a bit, and then you refine the questi…

pandas字符串操作(上)

目录 数据预览&#xff1a; 一、split分割列 1.需求&#xff1a; 2.完整代码展示 3.讲解 &#xff08;1&#xff09;分割 &#xff08;2&#xff09;写入 4.效果展示 二、partition分割列 1.需求&#xff1a; 2.完整代码展示 3.讲解 &#xff08;1&#xff09;分割…

推荐系统模型(一) DFN 详解 Deep Feedback Network for Recommendation

背景 在大多数的推荐系统中&#xff0c;往往注重于隐式正反馈(例如&#xff1a;点击)&#xff0c;而忽略掉用户的其他行为(例如大多数CTR模型只考虑用户的喜欢&#xff0c;而忽略了不喜欢)。腾讯在Deep Feedback Network for Recommendation 一文中&#xff0c;提出了一个新颖…

【网络安全】【密码学】【北京航空航天大学】实验一、数论基础(上)【C语言和Java实现】

实验一、数论基础&#xff08;上&#xff09; 一、实验目的 1、通过本次实验&#xff0c;熟悉相关的编程环境&#xff0c;为后续的实验做好铺垫&#xff1b; 2、回顾数论学科中的重要基本算法&#xff0c;并加深对其的理解&#xff0c;为本学期密码学理论及实验课程打下良好…

蓝桥杯备赛 | 洛谷做题打卡day5

蓝桥杯备赛 | 洛谷做题打卡day5 图论起航&#xff0c;一起来看看深&#xff08;广&#xff09;度优先吧 ~ 文章目录 蓝桥杯备赛 | 洛谷做题打卡day5图论起航&#xff0c;一起来看看深&#xff08;广&#xff09;度优先吧 ~【深基18.例3】查找文献题目描述 输入格式输出格式样例…

易基因:表观遗传学和表观转录组修饰在植物金属和准金属暴露中的作用 | 抗逆综述

大家好&#xff0c;这里是专注表观组学十余年&#xff0c;领跑多组学科研服务的易基因。 非必需金属&#xff08;non-essential metal&#xff09;和准金属&#xff08;metalloid&#xff0c;也称类金属&#xff09;对土壤的污染是全球许多地区面临的严重问题。这些非必需金属…

python 爬虫 生成markdown文档

本文介绍的案例为使用python爬取网页内容并生成markdown文档&#xff0c;首先需要确定你所需要爬取的框架结构&#xff0c;根据网页写出对应的爬取代码 1.分析总网页的结构 我选用的是redis.net.com/order/xxx.html (如:Redis Setnx 命令_只有在 key 不存在时设置 key 的值。…

【Azure 架构师学习笔记】- Azure Databricks (6) - 配置Unity Catalog

本文属于【Azure 架构师学习笔记】系列。 本文属于【Azure Databricks】系列。 接上文 【Azure 架构师学习笔记】- Azure Databricks (5) - Unity Catalog 简介 UC的关键特性 之所以DataBricks要用UC&#xff0c; 很大程度是对安全的管控。从上文可以了解到它的四大特性&#…

C++ OJ基础

C OJ基础 在学校学习C程序设计基础课程的OJ题目 缺少第二十题 这里写目录标题 C OJ基础习题练习(一)打印图形习题练习(二)数据的输入输出习题练习(三)函数重载习题练习(四)设计矩形类习题练习(五)定义Tree类习题练习(六)完善职工工资类Salary的设计习题练习(七)设计矩形类recta…

双目测距工程Stereo-Vision-master学习笔记

硬件&#xff1a; 首先要要把两个摄像头固定到支架上&#xff0c;并且两个摄像头的间距应该在110mm&#xff0c;两个摄像头没有落差 相机的内参数包括焦距、主点坐标、像素尺寸等&#xff0c;这些参数决定了相机成像的几何变换关系。内参数是相机固有的属性&#xff0c;不会随…